How to stretch and squeeze an image in PyTorch?

Viewed 283

I am working on MNIST Digit Data and looking for a way to either stretch or squeeze the image. The data is of the shape (28,28) and I want the final image to be of the same shape but either stretched or squeezed.

Is there any way to do it using torchvision.transforms or using any other method?

1 Answers

I think you are looking for transforms.RandomAffine.
Stretching and squeezing the image can be done by scaling it.

Related