Your issue makes sense, since gradient calculation is disabled in custom autograd.Functions by default.
You could check it in this example 1 via print(torch.is_grad_enabled()) in the forward and would see that it’s returning False so you would have to manually enable it.
Sorry for missing it, but I thought the question is asking how to check if gradient calculation is enabled or not.