111391:

self.layer1= nn.Linear(28*28, 128)
height, width = 28, 128


You’ve provided the wrong height and width values. When flattened, 28x128 gives a tensor of length 3584, but your nn.Linear layer expects a 28x28 (784) value.