numpy.dot和a.dot(b)之间的区别 [英] Difference between numpy.dot and a.dot(b)
本文介绍了numpy.dot和a.dot(b)之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
两者之间是否有区别
import numpy as np
np.dot(a,b)
和
a.dot(b)
在内部? 我找不到关于后一种方法的任何文档.
internally? I wasn't able to find any documentation on the latter method.
推荐答案
如果a
是数组,则它们等效.您无法找到dot
方法的文档是这里,然后归结为请参见 numpy.dot
".
If a
is an array, they're equivalent. The docs you couldn't find for the dot
method are here, and they boil down to "see numpy.dot
".
如果为type(a) is not numpy.ndarray
,则numpy.dot
会将a
转换为数组并使用该数组进行乘法运算,而a.dot
将执行a
的类型所说明的操作,或者引发AttributeError a
没有dot
方法.
If type(a) is not numpy.ndarray
, then numpy.dot
will convert a
to an array and use the array for the multiplication, while a.dot
will do whatever a
's type says it does, or raise an AttributeError if a
doesn't have a dot
method.
这篇关于numpy.dot和a.dot(b)之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文