Skip to content

Conversation

gramalingam
Copy link
Contributor

This PR makes two fixes:

  • The existing checker does not allow an attribute to have an empty list (of ints, or floats, or strings, etc.) as a value. The PR removes this check. It is better for op-specific checks to check for this where required.
  • There are similar checks in the shape-inference method of the Constant op, which are also removed.

This allows a Constant op to construct an empty 1D tensor of ints or floats, for example, conveniently.

Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
@gramalingam gramalingam requested review from a team as code owners September 1, 2023 03:16
@justinchuby
Copy link
Member

Just wondering: Do we know definitively which field is set (to know the dtype) when they are empty?

@gramalingam
Copy link
Contributor Author

Just wondering: Do we know definitively which field is set (to know the dtype) when they are empty?

Yes ... AttributeProto has a type field. (Further, the operator spec also constrains the type of a named attribute: eg., for Constant, value_ints is required to be ints type.)

@justinchuby
Copy link
Member

I see!

@justinchuby justinchuby added the module: checker onnx.checker label Sep 1, 2023
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
@justinchuby justinchuby requested a review from xadupre September 11, 2023 19:11
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
Signed-off-by: Ganesan Ramalingam <grama@microsoft.com>
@gramalingam
Copy link
Contributor Author

@xadupre : any further comments on this PR? Thanks!

@gramalingam gramalingam added this pull request to the merge queue Sep 26, 2023
Merged via the queue into onnx:main with commit d14f721 Sep 26, 2023
@gramalingam gramalingam deleted the empty-list-check branch September 26, 2023 16:12
@gramalingam gramalingam added this to the 1.15 milestone Sep 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: checker onnx.checker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants