The new version is same to your Lua version, but in Pytorch, I use the similar code, i find there is no model.backward method, so the gradient of model can't update.
loss = self.whdr_loss.forward(pred, label_txt)
grad = self.whdr_loss.backward()
# model.backward(inp, grad)
Hi, Fan! I implement a WHDRHingeLossPara class in PyTorch version, the code is followed,
The new version is same to your Lua version, but in Pytorch, I use the similar code, i find there is no model.backward method, so the gradient of model can't update.
Do you have any idea? Thank you very much!