Can We Update Target when Using smooth_l1_loss?

Hi, I am using smooth_l1_loss to compute the distance between two features, and then update for both of the features. However, I found that the autograd will not do update on the second input (i.e. the target). Is there a way to enable such update?


1 Like

The simplest first solution I see is to compute two losses:

loss_1 = F.smooth_l1_loss(feature1, feature2)
loss_2 = F.smooth_l1_loss(feature2, feature1)
loss = loss_1 + loss_2
1 Like

This would give larger loss than usually though. It would be harder to interpret.