Sorry, I’m not very familiar with version of python and cudatoolkit but there should not be a slowdown with the more recent versions!
Is torch.autograd.grad() becoming much slower with the latest version of pytorch even when you don’t use the hooks?
It is expected that using the hooks will incur a performance penalty.