Hi,
The one thing I would check is the clamp op that will generate 0 gradients for all the clamped values. So you want to make sure that the initial value of a is properly within the linear region of the clamp.
Otherwise, you also want to make sure that both a.is_leaf() and a.requires_grad are True.