You could use the functional API via torchvision.transforms.functional as seen in this example.
torchvision.transforms.functional