Skip to content
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

Support axis equal to tensor rank in Flatten operator #577

Merged
merged 1 commit into from
Feb 4, 2025

Conversation

robertknight
Copy link
Owner

Unlike most operators with an axis attribute, the value here can be equal to the tensor rank because it is a count of dimensions. Per spec 1:

Indicate up to which input dimensions (exclusive) should be flattened to
the outer dimension of the output. The value for axis must be in the range
[-r, r], where r is the rank of the input tensor.

Footnotes

  1. https://onnx.ai/onnx/operators/onnx__Flatten.html#attributes

Unlike most operators with an `axis` attribute, the value here can be equal to
the tensor rank because it is a count of dimensions. Per spec [^1]:

> Indicate up to which input dimensions (exclusive) should be flattened to
> the outer dimension of the output. The value for axis must be in the range
> [-r, r], where r is the rank of the input tensor.

[^1]: https://onnx.ai/onnx/operators/onnx__Flatten.html#attributes
@robertknight robertknight merged commit eaaf34b into main Feb 4, 2025
2 checks passed
@robertknight robertknight deleted the flatten-axis-equal-to-rank branch February 4, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant