数组切片中的None 数组[None]
增加一个维度
import torch as t a = t.randn((128,)) a.shape >>>torch.Size([128]) a[:, None].shape >>>torch.Size([128, 1])
增加一个维度
import torch as t a = t.randn((128,)) a.shape >>>torch.Size([128]) a[:, None].shape >>>torch.Size([128, 1])