Hi,
I am running a CNN experiment where my y shape is (32, 56, 56) and y_pred is (32, 313, 56, 56), 32 is batch size and images are 56x56. For classification when I use nn.CrossEntropyLoss() it accepts these tensors of different shapes but I also need to get results for MSELoss to show that MSE is not the better metric. I get following error:
loss_fn = nn.MSELoss(reduction='mean')
UserWarning: Using a target size (torch.Size([32, 56, 56])) that is different to the input size (torch.Size([32, 313, 56, 56])).
This will likely lead to incorrect results due to broadcasting. Please ensure they have the same size.
return F.mse_loss(input, target, reduction=self.reduction)
Can you please let me know how use MSELoss with different tensor shapes. I checked the parameters in nn.MSELoss() page but did not find anything I can use.
Thank You,