Apply the outputs argument when converting a MIL program - #2884
Open
Om-singhaI wants to merge 1 commit into
Open
Om-singhaI wants to merge 1 commit into
Om-singhaI wants to merge 1 commit into
Conversation
ct.convert ignored outputs for a MIL program, so the requested names and dtypes were dropped and a wrong number of outputs was accepted. Rename the outputs and set the output types in MILFrontend like the other frontends do, and raise a ValueError when the number of outputs doesn't match. A function input, or a var returned more than once, gets an identity copy under the new name instead of being renamed in place.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1679
ct.convertignoresoutputswhen the model is a MIL program. Names and dtypes get dropped, and even a list with the wrong number of entries goes through. Both backends are affected.MILFrontendonly handledinputs. Now it also renames the output vars and callsset_output_types, like the torch and TensorFlow frontends do, so the existingupdate_output_dtypespass applies the dtypes. If an output is a function input, or the same var is returned twice, it gets anidentitycopy under the new name, so the input or the other output keeps its name.Passing a different number of outputs than the program returns now raises a
ValueErrorinstead of being ignored.The new tests only build pymil programs, so they don't need torch. They fail with
converter.pyfrom main and pass on this branch:I also ran all of
test_programs.py,test_debug.py,test_api_examples.py,milproto/test_load.pyandTestUpdateOutputDtypeson macOS 26: 149 passed, 2 skipped, 3 xfailed.