-
Notifications
You must be signed in to change notification settings - Fork 409
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
better repalce_node fn #934
better repalce_node fn #934
Conversation
So the order of the nodes would stay the same, right? Is there a possibility to reorder the nodes? (I am not saying it is needed; just trying to understand.) |
I will tentatively put this as 0.8.1 milestone, but I would be fine deferring to 1.0. |
They should stay the same for the current implementation (copy in order w/ replacing a single k/v pair). What do you mean by reorder in this case? Shuffling the nodes will break the graph in general I guess. |
I was thinking if there was a case where the new node expected the order of inputs to be different than the old node. It's more hypothetical, without a specific case in mind. ONNX nodes often have multiple inputs with specific roles assigned to specific inputs, but we usually transform the special inputs early. |
Do the tests ever produce a case when the length or the inputs or outputs is not one? I tried looking with a debugger and didn't see it in the tests, but I could have missed it. |
By the way, to answer my question about the replaced nodes having one input and output only in the test, I think that's true, but this fix properly handles the case when the node after the replaced node has multiple inputs, which the test demonstrates. So after properly setting the output directories, I think I can merge this PR and make 0.8.1. |
Description
Make
ModelGraph.replace_node
method work with nodes work with replacing nodes, which itself/parents/children have multi-input/outputs.#932 will be fixed with this PR.
This fix is rather long but keeps the previous behavior in most cases. A much shorter version will be simply doing
but the final variable names will be different from the current version.
Type of change
Tests
Integrated with
test_repack_precision
, renamed totest_repack_stream
Checklist
pre-commit
on the files I edited or added.