-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Drop "one of" default attribute check in LabelEncoder #5673
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
9b90f6c
Drop default one of check
adityagoel4512 27eecd9
Check tensor type and dims
adityagoel4512 cd6531e
Fix up
adityagoel4512 b64678c
Skip if undefined data type
adityagoel4512 ea5b495
Merge branch 'main' into fix-shape-inference
adityagoel4512 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains 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
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.
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.
The new test just ensures the consistency of the operator when default_tensor is set. According to the description of the PR, it was failing in any other case. No unit test is failing, so I assume it was not tested. Is it possible to fix the behaviour and add unit test to check it is doing as expected?
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.
It's not quite that. When implementing the operator in ORT, I was finding the type inference fails even if I have only specified one of the default_* attributes. There seems to be to do with the fact that the default_* attributes tend to have values specified since they are optional.
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.
Some failure cases are checked here. Is there something you think is missing?
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.
All tests involve
default_tensor
, there is no test to check that a default value is not defined or defined with an unexpected attribute such as (value_int64s, default_floats). A test like that would have failed with your change.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.
I don't think that is something we want, since the default value has a fallback (e.g. -1 for int64_t) specified in the specification. This is why it is not tested in the previous implementation I believe.
I think this will run into the same issues with ORT unfortunately, but I can check.
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.
Just to clarify Aditya's point (in answer to Xavier's question): since the op-spec specifies a default-value for the various attributes, we need to be careful when flagging an error here: we cannot do that unless we can distinguish whether an attribute-value was explicitly specified in the node, or whether it is getting a default-value from the op-spec. (We should not be flagging an error when we get a default-value from the op-spec.) At the root of this, we have the issue that shape-inference works with the
InferenceContext
abstract interface, which exposes thegetAttribute
method. If we want to do such error-checking, we need to extend the interface to distinguish between the two cases mentioned above.)So, undoing this check makes sense to me. My two cents.
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.
Explained much better than me! Thanks