Hi,
The problem is that your count_diffs() method actually returns a LongTensor. And we can’t really have gradients for integer types.
You will need to find a version of your loss that only uses continuous values for it to be differentiable.