文章目錄
示例
import numpy as np
A = np.random.randn(n_x, n_y) # [n_x, n_y]隨機矩陣/0矩陣
np.zeros(n_x, n_y)
np.random.seed(1) #產生seed爲1的隨機數
C0 = np.dot(A, B) #dot 是矩陣乘
C1 = np.multiply(A, B) #multiply/*是元素對應乘
C1 = A * B
A = np.arrange(20).reshape(4, 5)
A.shape(0) = 4
A.shape(1) = 5
np.random.randn() #正態分佈
np.random.rand() #0~1分佈
np.random.randint() #low~high int分佈
a = np.random.randn(1, 1)
a = np.squeeze(a) # This turn [[a]] to a
assert(a.shape == () )