numpy.dot和a.dot(b)之间的区别 [英] Difference between numpy.dot and a.dot(b)

查看:985
本文介绍了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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆