作用:增加 none 所在维度
证明:下面代码运行一下就明白了
import numpy as np
# import torch
x = np.array([1,2,3,4,5,6]) # shape (6,)
print(x.shape)
y = x[:,None] # (6, 1)
print(y.shape)
xx = np.array([[1,2,3],[4,5,6]]) # (2, 3)
print(xx.shape)
yy1 = xx[:,:,None] # (2, 3, 1)
print(yy1.shape)
yy2 = xx[:,None] # (2, 1, 3)
print(yy2.shape)
yy2 = xx[None,] # (1, 2, 3)
print(yy2.shape)