I learned about Hooks for autograd saved tensors — PyTorch Tutorials 2.6.0+cu124 documentation.
But I am missing one detail. I’d like to implement a pack/unpack hook which applies to specific nodes only. I’d expect that when the tensor is created in forward, I can tag it somehow and then identify it in pack_hook
. But I failed to find anything.
What is the simplest way to identify specific tensors in the pack hook?