The last linear layer should output num_classes logits, so you would have to define self.linear_1 = nn.Linear(..., num_classes).
Also, pred = torch.argmax(output, 1) can be defined outside of the model, if needed (you also changed it to torch.max now).