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


![Python, typing: 函數庫規格標註; def addTest(x:float, y:float) -> float: List[資料型態] Set[資料型態] Tuple[資料型態] Dict[str,value的資料型態] Union[資料型態1, 資料型態2] ,函式若有多個輸出值,其實是輸出一個tuple Python, typing: 函數庫規格標註; def addTest(x:float, y:float) -> float: List[資料型態] Set[資料型態] Tuple[資料型態] Dict[str,value的資料型態] Union[資料型態1, 資料型態2] ,函式若有多個輸出值,其實是輸出一個tuple](https://i0.wp.com/savingking.com.tw/wp-content/uploads/2022/09/20220907154601_86.png?quality=90&zoom=2&ssl=1&resize=350%2C233)

![Python: 如何使用numpy.newaxis 增加資料的維度? y = x[:, np.newaxis] Python: 如何使用numpy.newaxis 增加資料的維度? y = x[:, np.newaxis]](https://i2.wp.com/savingking.com.tw/wp-content/uploads/2023/03/20230313184351_57.png?quality=90&zoom=2&ssl=1&resize=350%2C233)





近期留言