so the images where originally in torch.Size([28, 28, 3]). But as pytorch takes input in [channels, height, width]. I changed it to torch.Size([3, 28, 28]) using the permute() function.
And using images.view(images.shape(0), -1) gives the following error

TypeError                                 Traceback (most recent call last)
 in ()
7         #######################
8         if torch.cuda.is_available():
9             images = Variable(images.view(images.shape(0),-1).cuda())
10             labels = Variable(labels.cuda())
11         else:
TypeError: ‘torch.Size’ object is not callable