你的数组是:
a = np.array([1, 0, 0, 1, 0, 1, 0, 1])
需要扩充成:
a = np.array([[1 0 0 1 0 1 0 1]
[1 0 0 1 0 1 0 1]
[1 0 0 1 0 1 0 1]])
命令如下:np.expand_dims(a,0).repeat(3,axis=0)
你的数组是:
a = np.array([1, 0, 0, 1, 0, 1, 0, 1])
需要扩充成:
a = np.array([[1 0 0 1 0 1 0 1]
[1 0 0 1 0 1 0 1]
[1 0 0 1 0 1 0 1]])
命令如下:np.expand_dims(a,0).repeat(3,axis=0)