Is there a difference between
import numpy as np
np.dot(a,b)
and
a.dot(b)
internally? I wasn't able to find any documentation on the latter method.
Is there a difference between
import numpy as np
np.dot(a,b)
and
a.dot(b)
internally? I wasn't able to find any documentation on the latter method.
If
a
is an array, they're equivalent. The docs you couldn't find for thedot
method are here, and they boil down to "seenumpy.dot
".If
type(a) is not numpy.ndarray
, thennumpy.dot
will converta
to an array and use the array for the multiplication, whilea.dot
will do whatevera
's type says it does, or raise an AttributeError ifa
doesn't have adot
method.