Hi,
You are right that if you don’t use pytorch for some things, you won’t be able to use autograd.
The way to get around this is to create a custom Function (see here 104 how to) that specifies how to compute the backward for a given op. That way, you can wrap the code that the autograd cannot handle in the forward and write the backward by hand there. And then you will be able to use this as any differentiable function in the autograd.