下面有两种方法都可以: import numpy as npa=np.asarray([[10,20],[101,201]]) # a=a[:,:,np.newaxis]# print(a.shape)# b= a.repeat([3],axis=2)# print(b.shape,b) image = np.expand_dims(a, axis=2)image = np.concatenate((image, image, image), axis
下面有两种方法都可以:
|
2019-06-18
2019-07-04
2021-05-23
2021-05-27
2021-05-27