torch Tensor add dimension
I have a tensor with this size
torch.Size([128, 64])

how do I add one &quot;dummy&quot; dimension such as
torch.Size([1, 128, 64])


There are several ways:
torch.unsqueeze:
torch.unsqueeze(x, 0)


Using None (or np.newaxis):
x[None, ...]
# or
x[np.newaxis, ...]


reshape or view:
x.reshape(1, *x.shape)
# or
x.view(1, *x.shape)

