Hi,
What I usually do when I need this is to trigger it directly from inside the backward function with     import pdb; pdb.set_trace():
import torch
from torch import autograd

class F(autograd.Function):
  @staticmethod
  def forward(ctx, foo):
    return foo.clone()

  @staticmethod
  def backward(ctx, bar):
    import pdb; pdb.set_trace()
    return bar.clone()

a = torch.tensor([3.2], requires_grad=True)
b = F.apply(a)
g = autograd.grad(b, a)[0]