Hy @Leo_Frez



 Leo_Frez:

x = torch.randn(480, 640).view(-1, 3, 480, 640)


So torch.randn(480,640) will generate a tensor of shape (480,640) right. further view(-1,3,480,640) will try to reshape it to array of size (3 * 480 * 640), so the size are not equal. That’s your immediate error.
Way around is
torch.randn(3,480,640).view(-1,3,480,640)