Trying to understand modules/variables/autograd a bit better, so I made a a loss function that penalizes a point by 1 if it is 0.5 away from the target and 0 otherwise. I used the following forward

But I get the error RuntimeError: there are no graph nodes that require computing gradients when I run backward() on this loss. I don’t seem to release any data from variables or use numpy arrays. So I think I’m misunderstanding something fundamental about autograd. Any help would be appreciated. Thanks