To find r2score of my model

I have a UNet model. I’m trying for a regression model since, in my output, I have different floating values for each pixel. In order to check the r2score, I tried to put the below code in the ‘model class’, training_step, validation_step, and test_step.

from pytorch_lightning.metrics.functional import r2score
r2 = r2score(logits, y)

But it’s giving the following error

ValueError: Expected both prediction and target to be 1D or 2D tensors, but recevied tensors with dimension torch.Size([50, 1, 32, 32])

How can I check my model fit?

Hello, my apology for the late reply. We are slowly converging to deprecate this forum in favor of the GH build-in version… Could we kindly ask you to recreate your question there - Lightning Discussions