TensorFlow之Numpy(3)

官网:www.numpy.org

代码示例:

 1 import numpy as np
 2 
 3 #数组定义
 4 vector = np.array([1, 2, 3])
 5 
 6 #长度
 7 vector.shape
 8 #大小
 9 vector.size
10 #维度/阶数
11 vector.ndim
12 #类型
13 type(vector)
14 
15 matrix = np.array([ [1, 2], [3, 4] ])
16 matrix.shape
17 matrix.ndim
18 matrix.size
19 type(matrix)

猜你喜欢

转载自www.cnblogs.com/xyqiu90-365/p/9715992.html