Hi,
The wasn’t very clear about this, but the latest version here 72 should be better. In particular, you have to mark non-differentiable outputs explicitly in your custom Functions.
In you case, you should add at the end of test_discrete_grad_1's forward function:
ctx.mark_non_differentiable(new_ind)