title: How to find r2score of my PyTorch model for regression
body: <p>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 <code>model class</code>, training_step, validation_step, and test_step.</p>
  <p><code>from pytorch_lightning.metrics.functional import r2score</code></p>
  <p><code>r2 = r2score(pred, y)</code></p>
  <p><code>self.log('r2:',r2)</code></p>
  <p>But it's giving the following error</p>
  <blockquote>
  <p>ValueError: Expected both prediction and target to be 1D or 2D tensors, but recevied tensors with dimension torch.Size([50, 1, 32, 32])</p>
  </blockquote>
  <p>How can I check my model fit?</p>