In below code i have to use “unsqueeze” 2 times for 3d conversion. Is there anyway to convert 1d to 3d using “unsqueeze” single time.
from torchvision import transforms
a=torch.ones([5],requires_grad=True) * - 0.5
a=a.unsqueeze_(0)
a=a.unsqueeze_(0)
print(a.shape)