Hi,
I’ve been trying many things without success, unfortunately. Basically, this is what I want:
X --> PyTorch model --> X* --> TF model
Then, I can obtain the gradient w.r.t X* through the TF model, but I want to propagate it through the PyTorch model to obtain an X.grad.
This is how far I’ve come:

image.png1510×1010 152 KB

I’ve been using this 4 and this 3 to get so far.
I’m new to writing custom gradient functions, so my code probably doesn’t make much sense.  Hope anyone can help out.
Thanks