In my forward function, I run nn.MSELoss() forwards, but I need to run it (or something similar) backwards, inside my backwards function.
For example:
class InputLoss(nn.Module):

    def __init__(self, strength, normalize):
    self.loss = self.strength
    self.target = torch.Tensor()
    self.crit = nn.MSELoss()

    def forward(self, input):
         self.loss = self.crit(input, self.target) * strength # Forward Crit

    def backward(self, input, gradOutput):
         self.gradInput = self.crit.backward(input, self.target) * strength # Backward Crit

How would I got about doing this?