1.numpy升维
比如维度由(5,)变为(5,1)
import numpy as np
a=np.random.randn(5)
b=np.expand_dims(a,axis=1)
print(a.shape)
print(b.shape)
输出
2.降维
c=b.squeeze()
print(c.shape)
输出
1.numpy升维
比如维度由(5,)变为(5,1)
import numpy as np
a=np.random.randn(5)
b=np.expand_dims(a,axis=1)
print(a.shape)
print(b.shape)
输出
2.降维
c=b.squeeze()
print(c.shape)
输出