TorchVision. Transformations aplaties

import torchvision.transforms as T
transform=T.Compose([T.ToTensor(), T.Lambda(lambda x: torch.flatten(x))])
Wide-eyed Wolverine