Why does numpy Dot product of 2d array with 1d array produce 1d array?

前端 未结 4 1035
感情败类
感情败类 2020-12-22 01:07

I try to run the code like below:

>>> import numpy as np
>>> A = np.array([[1,2], [3,4], [5,6]])
>>> A.shape
(3, 2)
>>> B         


        
4条回答
  •  执念已碎
    2020-12-22 01:47

    I just learned this dot product from Neural Network... Anyway, it is the dot product between "1d" array and "nd" array. enter image description here

    As we can see, it calculates the sum of the multiplication for elements separately in the red box as "17 + 28" Then enter image description here

    Then enter image description here

提交回复
热议问题