-
Notifications
You must be signed in to change notification settings - Fork 4
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
Split value prop #189
base: main
Are you sure you want to change the base?
Split value prop #189
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on and great work to already make the tests pass! I am trying to grok the details of the implementation. While doing so I already left a few high-level comments. I am not quite convinced that the use of a meta class is buying us much with respect to the introduced complexity/scariness of it. Would you mind adding type hints for its use and/or point out where it would provide a mypy-testable benefit compared to a simpler/dynamic structure such as a dict[str, Var]
s?
) | ||
) | ||
out_values = self.propagate_values(input_prop_values) | ||
return self.outputs._propagate_vars(out_values) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a bit of a pitty that we don't have any output type here. Having a type such as dict[str, Var]
would be better than nothing. I'm not sure how we could type this properly using the TypeBaseVars
. If we lose the type information already here, is the TypeBaseVars
-complexity really worth the effort?
Are you sure there isn’t a cleaner way of doing this? Or perhaps some simpler hack. It feels like a significant change. |
Thanks for your feedback @jbachurski ! Let me provide a little more context.
Yes, it did indeed! ndonnx makes it very easy to try out NumPy code with constant arrays. So much so that it is perfectly reasonable to quickly convert large NumPy arrays into ndonnx ones and to throw them at our code. While technically still a "debugging" feature, it is now used very commonly during development and on very large graphs. The value propagation in ndonnx is currently re-implemented there, but I believe it would be cleaner to do it properly here in Spox on the operator level. |
Curious. Yes, I noticed that it was early on and found it surprising, but I didn't want to question it :) I'll let you know in case I come up with something accidentally but yeah, it's unfortunately an extremely busy period for me to think over this design aspect. |
Fixes #187 by making the current user-facing
Var
be a wrapper around a helper classVarInfo
, whereVar
is a pair(VarInfo, PropValue)
.The idea is to have
VarInfo
be the object that is passed around inside of all functions and be pointed to by allNode
-s, so concrete propagated values can be garbage collected correctly.Checklist for implementation
input_prop_values
dictionaryadapt_node
CHANGELOG.rst
entryVar
-s passed to manual inferenceBreaking changes checklist