I am running in to RuntimeWarning: Invalid value encountered in divide
import numpy a = numpy.random.rand((1000000, 100)) b = numpy.random.rand((1,100))
You can use np.where( condition ) to perform a conditional slice of where norms does not equal 0 before dividing:
norms = np.where(norms != 0 ) angles = dots/norms