CIFAR10 returns images of the shape [3, 32, 32], which won’t work using your .view(-1, 28*28) call.
Instead use .view(-1, 3*32*32) and set the same value as the number of input features to your first linear layer.
Also, Variables are deprecated, so you can use tensors directly.