Skip to content

[xla] Change Shape::IsArray and Shape::IsArrayOrBuffer. #97389

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

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Jul 23, 2025

[xla] Change Shape::IsArray and Shape::IsArrayOrBuffer.

Currently, Shape::IsArray returns true when the shape is an array primitive and Shape::IsArrayOrBuffer returns true when the shape is an array primitive or a buffer primitive. The majority use of Shape::IsArray is to exclude TOKEN/TUPLE so that we can further find out the storage element_type for the Shape. For this reason, In order to support the new Buffer type, we would need to change most of uses of Shape::IsArray to Shape::IsArrayOrBuffer, leaving only a few uses of Shape::IsArray within shape_util and shape_inference.

To avoid such a massive change, we decide to make Shape::IsArray to return true when the shape is either an array or a buffer, which is what the current Shape::IsArrayOrBuffer does. We also move the current Shape::IsArray to a new routine Shape::IsArrayExcludingBuffer, which should have very limited uses, such as in shape_inference and shape_util.

Currently, Shape::IsArray returns true when the shape is an array primitive and Shape::IsArrayOrBuffer returns true when the shape is an array primitive or a buffer primitive. The majority use of Shape::IsArray is to exclude TOKEN/TUPLE so that we can further find out the storage element_type for the Shape. For this reason, In order to support the new Buffer type, we would need to change most of uses of Shape::IsArray to Shape::IsArrayOrBuffer, leaving only a few uses of Shape::IsArray within shape_util and shape_inference.

To avoid such a massive change, we decide to make Shape::IsArray to return true when the shape is either an array or a buffer, which is what the current Shape::IsArrayOrBuffer does. We also move the current Shape::IsArray to a new routine Shape::IsArrayExcludingBuffer, which should have very limited uses, such as in shape_inference and shape_util.

PiperOrigin-RevId: 786718069
@copybara-service copybara-service bot force-pushed the exported_pr_785976841 branch from a3dd337 to 4c4d59c Compare July 24, 2025 15:52
@copybara-service copybara-service bot merged commit 4c4d59c into master Jul 24, 2025
@copybara-service copybara-service bot deleted the exported_pr_785976841 branch July 24, 2025 15:52
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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy