-
Notifications
You must be signed in to change notification settings - Fork 643
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
torch.fill_ can not apply after general function #1924
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 |
---|---|---|
|
@@ -135,17 +135,7 @@ def _construct_nodes_to_fuse_inputs(nodes_to_fuse): | |
tensor_to_node_sequence_mapping.pop(node_input) | ||
node_sequence.append(node) | ||
tensor_to_node_sequence_mapping[node_output] = node_sequence | ||
|
||
if node.kind == "to": | ||
node_input = node.inputs[0] | ||
if node_input in tensor_to_node_sequence_mapping: | ||
# update the mapping | ||
node_output = node.outputs[0] | ||
val = tensor_to_node_sequence_mapping[node_input] | ||
del tensor_to_node_sequence_mapping[node_input] | ||
tensor_to_node_sequence_mapping[node_output] = val | ||
|
||
if node.kind in ("copy_", "fill_"): | ||
elif node.kind in ("copy_", "fill_"): | ||
node_input = node.inputs[0] | ||
if node_input not in tensor_to_node_sequence_mapping: | ||
raise ValueError("No matching select or slice.") | ||
|
@@ -176,6 +166,13 @@ def _construct_nodes_to_fuse_inputs(nodes_to_fuse): | |
blocks=[], | ||
) | ||
graph.nodes[i] = tensor_assign_node | ||
elif node.inputs: | ||
node_input = node.inputs[0] | ||
if node_input in tensor_to_node_sequence_mapping: | ||
# update the mapping | ||
node_output = node.outputs[0] | ||
val = tensor_to_node_sequence_mapping[node_input] | ||
tensor_to_node_sequence_mapping[node_output] = val | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you please share your reasoning on why this would be generally applicable for nodes in addition to Also, what is the reason to delete line There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
with
stacktrace
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
We need general solution of #1917 ex.
and all other operations. |
||
|
||
# modify the graph outputs if it is effected by this graph pass | ||
for idx in range(len(graph.outputs)): | ||
|
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.
Maybe remove the outmost parentheses to be
assert all(y_cm == np.zeros(shape))
?