numpy.matmul (ary1, ary2):
import numpy as np
list1 = [1,2,3]
list2 = [
[3],
[2],
[1]]
a1 = np.array(list1)
a2 = np.array(list2)
print(“對list做矩陣乘法np.matmul():”,
np.matmul(list1,list2))
print(“對array做矩陣乘法np.matmul():”,
np.matmul(a1,a2))
print(“只有array能用@做矩陣乘法:”,a1 @ a2)
print(“矩陣乘法@:”,list1 @ list2)
numpy.dot()
推薦hahow線上學習python: https://igrape.net/30afN
近期留言