from torchvision import transforms

M = torch.randint(low=0, high=2, size=(6, 64, 64), dtype = torch.float)
N = torch.randint(low=0, high=2, size=(3, 64, 64), dtype = torch.float)

gt_trans = transforms.Compose([
            transforms.ToPILImage(),
            transforms.Resize((64, 64)),
            transforms.ToTensor()])

print(M.shape)
print(gt_trans(M).shape)

print(N.shape)
print(gt_trans(N).shape)

Why is the number of channels of M reduced to 3 after the transformation? Thanks for your explanation(s).