Complete the code to create a composed transform that converts images to tensors.
transform = transforms.Compose([transforms.To[1]()])The ToTensor transform converts a PIL image or numpy array to a PyTorch tensor.
Complete the code to normalize images with mean 0.5 and std 0.5 using Compose.
transform = transforms.Compose([transforms.ToTensor(), transforms.Normalize(mean=[[1]], std=[0.5])])
The mean and std values are set to 0.5 to normalize image pixel values between -1 and 1.
Fix the error in the Compose transform that should resize images to 128x128 pixels.
transform = transforms.Compose([transforms.Resize([1])])The Resize transform expects a tuple for width and height, so (128, 128) is correct.
Fill both blanks to create a Compose transform that converts images to tensors and then randomly flips them horizontally.
transform = transforms.Compose([transforms.[1](), transforms.[2](p=0.5)])
First convert images to tensors with ToTensor, then apply random horizontal flip with RandomHorizontalFlip.
Fill all three blanks to create a Compose transform that resizes images to 64x64, converts to tensor, and normalizes with mean 0.5 and std 0.5.
transform = transforms.Compose([transforms.Resize([1]), transforms.[2](), transforms.Normalize(mean=[[3]], std=[0.5])])
Resize images to (64, 64), convert to tensor with ToTensor, then normalize with mean and std 0.5.