Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable OpFromGraph.L_Op/R_Op from being wrapped in their own OpFromGraph #1174

Open
ricardoV94 opened this issue Jan 25, 2025 · 0 comments
Labels

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Jan 25, 2025

The fact that we wrap a graph in OpFromGraph, doesn't mean we also want to wrap it's gradient. It can also lead to troubles as in pymc-devs/pymc#7657

I suggest adding a wrap_grad_in_ofg: bool kwarg that toggles this behavior. The easiest way to get this change is to keep the behavior as is, but call the inline_ofg rewrite manually after calling it here:

connected_input_grads = iter(
lop_op(*inputs, *connected_outputs, *connected_output_grads, **kwargs)
)

And here:

connected_output_grads = iter(rop_op(*inputs, **kwargs))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant