List expected types in operator type-mismatch error message#29214
Open
ArsalanShakil wants to merge 1 commit into
Open
List expected types in operator type-mismatch error message#29214ArsalanShakil wants to merge 1 commit into
ArsalanShakil wants to merge 1 commit into
Conversation
When a node input has a type that is not among the operator's permitted types, the resolve-time error reported only the offending type, which made it hard to know which types were valid. This was raised in microsoft#4429. Append the operator's permitted types (sorted for a deterministic message) to the existing 'Type Error' message. The existing text is preserved, so callers that match on the current substring are unaffected. Adds a graph test covering the new message.
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.
Description
When a node input has a type that is not among the operator's permitted types,
Graph::InferAndVerifyTypeMatchreports only the offending type. For example:This does not tell the user which types are actually valid, so they have to go look up the operator spec to understand the error.
This change appends the operator's permitted types to the existing message:
The permitted types are sorted so the message is deterministic. The existing text is preserved unchanged and only appended to, so callers that match on the current substring (for example the quantization Python tests) are unaffected.
A unit test in
graph_test.ccbuilds a graph that feeds anint64input toSin(a float-only operator) and asserts that the resolve error lists the expected types.Motivation and Context
Fixes #4429. The original report and a maintainer both noted it would be helpful for the error message to indicate the expected types, not just the offending one.