I am trying to embed the loss calculation in the model itself, rather than attaching the module at every iteration.
This requires the forward function to have another argument in the signature
forward(self, x, y), in order to have the info to calculate the loss.
What is the correct way to handle this for both train and eval mode?
Is defaulting y=None the recommended way of doing so?
I wasn’t able to find any documentation on it, any reference would be appreciated!