Based on the model definition, your output should come from the linear layer with an output of 10 units.
So apparently you are using a hook or skip some layers in your forward method?
The images from the MNIST dataset are too small for a resnet, as the standard spatial shape is 224x224.
You could use torchvision.transforms.Resize to increase the spatial size of your samples.