I am trying to get my net to output a prediction for each input image, but I am only getting it to predict two value, rather then 4 for each input image.
I was going through a pretrained CNN (mnist for digits) and it predicts 4 tensors desptie its final linear layer outputting 10 (not 4)
mnist dataset - not the one I want to fix
Your model uses two output neurons via
self.fc3, which will result in an output shape of
[batch_size, 2] and can be used for a 2-class multi-class classification.
Currently your model is most likely reshaping the activation in a wrong way, as the batch size is set to 4, while the model only returns a single prediction.
view operation to:
x = x.view(x.size(0), -1)
and you should get a shape mismatch error in
self.fc1. Use the reported shapes from the error message to change the
PS: you can post code snippets by wrapping them into three backticks ```, which would make debugging easier.