triplet_loss_kws icon indicating copy to clipboard operation
triplet_loss_kws copied to clipboard

Torch autograd expects Variable with requires_grad set to True

Open ags3927 opened this issue 3 years ago • 2 comments

Torch autograd expects Variable with requires_grad set to True but doesn't find such Variables. Any idea as to how to get around this?

ags3927 avatar Jul 11 '21 14:07 ags3927

In pytorch, you need set loss.requres_grad = True. In this project, loss fuction locate in triplet.py:line 50. I solved it through the following steps: mean_losses = losses.mean() mean_losses.requires_grad=True return mean_losses

ToughmanL avatar Jul 19 '21 13:07 ToughmanL

Please see if uncommenting this line helps, or the @ToughmanL's answer.

roman-vygon avatar Jul 21 '21 08:07 roman-vygon