-
Notifications
You must be signed in to change notification settings - Fork 132
OpFromGraph
difficult to subclass due to not allowing shared variables to be positioned explicitly as an input
#473
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
Comments
OpFromGraph.make_node
when shared inputs changes
PS: Shared variables are a mistake |
OpFromGraph.make_node
when shared inputs changesOpFromGraph
difficult to subclass with initialization variables due to make_node
The problem here is that the initialization of OpFromGraph prohibits explicit shared variables as inputs, but internally it still builds an Apply that has them as explicit inputs (much like Scan does, although scan allows shared variables as explicit inputs). The change in #473 allows one to recreate an existing OpFromGraph node where the shared variable is changed, sometimes by non-shared variables (desirable), but that requires that the Op itself be recreated because OpFromGraph forces shared variables to be the rightmost input (undesirable) of the respective Apply nodes. pytensor/pytensor/compile/builders.py Lines 823 to 858 in 9df55cc
Imagine we had an OpFromGraph whose node inputs where |
OpFromGraph
difficult to subclass with initialization variables due to make_node
OpFromGraph
difficult to subclass due to constraint that shared variables can't be positioned explicitly as an input
OpFromGraph
difficult to subclass due to constraint that shared variables can't be positioned explicitly as an inputOpFromGraph
difficult to subclass due to now allowing shared variables to be positioned explicitly as an input
We can simplify the restriction without breaking backwards compatibility: Allow shared variables to be any position as an input and to be passed explicitly, but still collect them automatically when the users doesn't remember to pass them. Like This means we don't need to handle SharedVariables at all inside |
OpFromGraph
difficult to subclass due to now allowing shared variables to be positioned explicitly as an inputOpFromGraph
difficult to subclass due to not allowing shared variables to be positioned explicitly as an input
Uh oh!
There was an error while loading. Please reload this page.
Description
The changes introduced in aesara-devs/aesara#902 make it hard to safely subclass
OpFromGraph
with initialization kwargs.Here is an example:
One would have to subclass
made_node
for this to work correctly, but that's highly non-trivial.The text was updated successfully, but these errors were encountered: