Conversion error at validation step

Hi Everyone I’m facing this conversion error after completing the validation step of my UNet regression model it is throwing this error: I don’t know am i providing the sufficient info for your understanding

File “C:\Python\Python 3.8.5\lib\site-packages\torch\utils\”, line 29, in make_np
raise NotImplementedError(
NotImplementedError: Got <class ‘torch.nn.modules.loss.MSELoss’>, but numpy array, torch tensor, or caffe2 blob name are expected. The code where im facing error is attached below:

    def validation_end(self, outputs):   # getting the mean of stack of validation losses
        avg_loss = torch.stack([x['val_loss'] for x in outputs]).mean()
        tensorboard_logs = {'val_loss': avg_loss}
        return {'avg_val_loss': avg_loss, 'log': tensorboard_logs}

Based on the error message it seems you are passing the class nn.MSELoss to the tensorboard visualization instead of a tensor or array containing the loss value.
Could you check the type of all objects and make sure they are valid values and not the loss function itself? :slight_smile: