-
Notifications
You must be signed in to change notification settings - Fork 28
fix reshape construction #941
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -159,11 +159,11 @@ def add_reshape_if_needed(mma: MMABase, prev_mma: MMABase, arg_index: int): | |
| arg = mma.lhs if arg_index == 0 else mma.rhs | ||
| arg = get_custom(arg) | ||
| if is_reshape_needed(arg, mma.vector_shapes, prev_mma.vector_shapes): | ||
| reshape = Reshape(arg.fx_node, prev_mma.vector_shapes).add_to_graph( | ||
| reshape = Reshape(arg.fx_node, mma.vector_shapes).add_to_graph( | ||
| mma.graph, loc=mma.location | ||
| ) | ||
| custom_reshape = get_custom(reshape) | ||
| custom_reshape.vector_shapes = mma.vector_shapes | ||
| custom_reshape.vector_shapes = prev_mma.vector_shapes | ||
|
Comment on lines
+162
to
+166
|
||
| propagate_tag(mma.fx_node, reshape) | ||
| mma.update_arg(arg_index, reshape) | ||
|
|
||
|
|
||
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.
Reshapeis being constructed withargs=arg.fx_node(a singlefx.Node). Downstream codegen (handle_reshape) treatsargsas a sequence (callslen(args)and indexesargs[0]), so passing a single node here will raise at runtime. Wrap the argument in a 1-element sequence (e.g.,[mma.lhs]/[mma.rhs]or[arg.fx_node]) soargsis always a list/tuple of nodes.