Assume your image being in tensor x
you could do x.unsqueeze(0)
or you could use the pytorch data package and it’s Datasets/Dataloader which automatically create minibatches.
For vision there is something similar in the torchvision package.
2 Likes