M.L code(p.77)
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#p77 - p82 import numpy as np A = np.array([1,2,3,4]) print(A) print(np.ndim(A)) print(np.shape(A)) print(A.shape[0]) B = np.array([[1,2], [3,4], [5,6]]) print(B) print(np.ndim(B)) print(np.shape(B)) A = np.array([[1,2], [3,4]]) print(A.shape) B = np.array([[5,6], [7,8]]) print(B.shape) print(np.dot(A,B)) A = np.array([[1,2,3], [4,5,6]]) print(A.shape) B = np.array([[1,2], [3,4], [5,6]]) print(B.shape) print(np.dot(A,B)) A = np.array([[1,2], [3,4], [5,6]]) print(A.shape) B = np.array([7,8]) print(B.shape) print(np.dot(A,B)) # 신경망행렬곱 X = np.array([1,2]) print(X.shape) W = np.array([[1,3,5],[2,4,6]]) print(W.shape) Y = np.dot(X,W) print(Y) print(Y.shape) |
