You could use the functional API of torchvision.transforms as described in this post.
torchvision.transforms