-
Notifications
You must be signed in to change notification settings - Fork 10
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
Bug fixes: nir.Output type inference & CubaLIF.w_in read/write #71
Conversation
Right now, the type inference goes through but it doesn't actually change the NIR graph. This PR fixes that.
|
yep I just wrote tests to check that this works, but the problem was something else. I will update the PR in a moment - sorry about the confusion |
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.
Hacky, but functional! LGTM 💰
@@ -261,6 +261,12 @@ def _forward_type_inference(self, debug=True): | |||
k.replace('output', 'input'): v for k, v in pre_node.output_type.items() | |||
} | |||
|
|||
# make sure that output nodes have output_type = input_type | |||
if isinstance(post_node, Output): | |||
post_node.output_type = { |
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.
Hmmmm this looks like a hack
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 feels hacky, but the output node is the only node whose input_type
field is irrelevant - so it's just a special case where we just have to set the output_type
as well. a cleaner solution would be that Input and Output only have a type
- but that would complicate many other things..
@@ -72,6 +72,7 @@ def read_node(node: typing.Any) -> nir.NIRNode: | |||
r=node["r"][()], | |||
v_leak=node["v_leak"][()], | |||
v_threshold=node["v_threshold"][()], | |||
w_in=node["w_in"][()], |
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.
☠️
Right now, the type inference goes through but it doesn't actually change the NIR graph. This PR fixes that.Update: this PR fixes a weird edge case where the input_type of a
nir.Output
node is inferred. This currently fails because it will not update the output_type for thenir.Output
node and this is used when writing the graph to a file. (hence, when writing to a file and reading again, the shape inference is essentially discarded).Update update: I've also added an urgent fix that adds
w_in
to the read and write method of theCubaLIF
node. This should have always been there..