code_15.py 780 字节
Newer Older
ToTensor's avatar
ToTensor 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
vector_01 = np.array([1, 2, 3])
vector_02 = np.array([[1], [2], [3]])
vector_03 = np.array([2])
vector_04 = vector_02.reshape(1, 3)
print ('vector_01的形状:', vector_01.shape)
print ('vector_02的形状:', vector_02.shape)
print ('vector_03的形状:', vector_03.shape)
print ('vector_04的形状:', vector_04.shape)
print ('01和01的点积:', np.dot(vector_01, vector_01))
print ('01和02的点积:', np.dot(vector_01, vector_02))
print ('04和02的点积:', np.dot(vector_04, vector_02))
print ('01和数字的点积:', np.dot(vector_01, 2))
print ('02和03的点积:', np.dot(vector_02, vector_03))
print ('02和04的点积:', np.dot(vector_02, vector_04))
print ('01和03的点积:', np.dot(vector_01, vector_03))
print ('02和02的点积:', np.dot(vector_02, vector_02))