python 乘

xiaoxiao2021-02-28  92

Array import numpy as np

#3*4 A = np.array([[1, 2 ,3 ,4],[5,6,7,8],[9,10,11,12]])

# 2 * 6

B = A.reshape(2,6) B =[[ 1 2 3 4 5 6] [ 7 8 9 10 11 12]]

# 6 * 2 C = A.reshape(6,-1) C = [[ 1 2] [ 3 4] [ 5 6] [ 7 8] [ 9 10] [11 12]]

1.np.dot() 正常的矩阵相乘(不论是一维还是多维)

2. * / np.multiply() 数组的shape 必须相同对应位置的元素相乘

Martrix 1.不论是 np.dot或者 都是正常的矩阵相乘* 2.np.multiply() 数组的shape 必须相同对应位置的元素相乘

转载请注明原文地址: https://www.6miu.com/read-35728.html

最新回复(0)