Apply horizontal, vertical flip, rotations etc to tensor

Hi, I am aware of that there are existing utilities for applying horizontal, vertical flips etc to PIL images. But is there a way to apply this to a 64 channel tensor?
The only solution I have is this:
Split the 64 channels into 1 channel each
For the two remaining channels put the same values as the original 1 channel
Convert to PIL Image
Apply transform
Convert back to tensor
Remove 2 extra channels
Repeat process 64 times
Then stack the tensors to get the augmented 64 channel tensor

This is a hugely inefficient method. I have looked at torch.fliplr but that only switches the color channels in practice.
So does anyone have any ideas or know of an existing pytorch function which does this already?
Thanks in advance

import torch
from torchvision import transforms
transform = transforms.Compose([
  transforms.Resize((400,400)),
  transforms.RandomHorizontalFlip(p=0.5),
  transforms.RandomVerticalFlip(p=0.5),
  transforms.RandomRotation(60)
])
z = transforms.Resize((400,400))
x = torch.ones(64, 2048, 2048)
y = transform(x)
print(y.shape)

You can do something like this for augumentation of tensors!

Thank you this works! I appreciate your help :slight_smile: