Constants / Root variables as Ops? #924
ricardoV94
started this conversation in
Ideas
Replies: 2 comments
-
Alternatively we can have a helper function |
Beta Was this translation helpful? Give feedback.
0 replies
-
I prefer the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Most rewrites we have to do something like
if x.inputs[0].owner is not None and isinstance(x.inputs[0].owner.op, log)
, when we are looking for say a log operation. The first check is to rule out root variables / constants that have no owner and therefore no owner.op.What if constants came out of a no-input Operation (parametrized by the constant value, so they can be distinguished merged), and root variables from a no-input Operation that can never be merged? Then we could always and safely do
isinstance(x.inputs[0].owner.op, log)
because all variables always have an owner and and Op (they may just not have any further inputs).We did something similar recently for the Outputs of an OpFromGraph: #790
Beta Was this translation helpful? Give feedback.
All reactions