I would like to calculate the L1 loss between two variables. For instance, network A outputs a, network B outputs b, and I would like a and b to be as close as possible, so the criterion will be L1Loss(a,b). But in Pytorch the target of L1 loss can’t be variable (no gradients), I received this error:
AssertionError: nn criterions don't compute the gradient w.r.t. targets - please mark these variables as volatile or not requiring gradients
What should I do to calculate the L1 Loss between two variables?