Skip to content

Deprecate ShapeOfXlaOp in favor of GetShape#9381

Merged
zhanyong-wan merged 1 commit intopytorch:masterfrom
zhanyong-wan:get-shape
Jun 17, 2025
Merged

Deprecate ShapeOfXlaOp in favor of GetShape#9381
zhanyong-wan merged 1 commit intopytorch:masterfrom
zhanyong-wan:get-shape

Conversation

@zhanyong-wan
Copy link
Copy Markdown
Collaborator

@zhanyong-wan zhanyong-wan commented Jun 17, 2025

For #9096

Deprecate ShapeOfXlaOp() as:

  1. It ignores potential errors from XLA and thus is unsafe.
  2. It violates the Google style guide: "Do not create classes only to group static members".
  3. The OfXlaOp part of the name is redundant as it's already obvious from the parameter type.

Replace it with a new function GetShape().

@zhanyong-wan zhanyong-wan enabled auto-merge (squash) June 17, 2025 19:35
@zhanyong-wan
Copy link
Copy Markdown
Collaborator Author

@ghpvnist and @ysiraichi , somehow GH doesn't let me request a code review on this PR. Can you review it anyway? Thanks.

Copy link
Copy Markdown
Collaborator

@ghpvnist ghpvnist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you plan to do a follow up to change existing uses of ShapeOfXlaOp?

@zhanyong-wan
Copy link
Copy Markdown
Collaborator Author

Do you plan to do a follow up to change existing uses of ShapeOfXlaOp?

There are many uses of this. I don't plan to rewrite all of them, as that doesn't have a big ROI. Instead, I may replace some of them as needed for improving a user error message.

@zhanyong-wan zhanyong-wan merged commit b737b4a into pytorch:master Jun 17, 2025
23 of 24 checks passed
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.

2 participants