Skip to content

Conversation

@guan404ming
Copy link
Member

Related Issue

Why

  • When run_ep_decomposition=True is enabled, PyTorch decomposes pad operators into lower-level operations:
    • Constant mode → constant_pad_nd.default
    • Reflect/Replicate modes → index.Tensor with None indices
    • Circular mode → copy.default and slice operations
  • Some of the decomposed operators were not supported, causing failures

How

  • Added support for constant_pad_nd.default and copy.default operator
  • Fixed _index_tensor to handle None indices by:
    • Using take operation when only one dimension is indexed (optimization)
    • Converting None to explicit arange for general cases
  • Updated test_pad to use run_ep_decomposition=True

@guan404ming guan404ming marked this pull request as ready for review November 14, 2025 16:37
@guan404ming
Copy link
Member Author

cc @tlopex

Copy link
Member

@tlopex tlopex left a comment

Choose a reason for hiding this comment

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

LGTM! Thank you

@tlopex tlopex merged commit f8471f8 into apache:main Nov 14, 2025
14 checks passed
@guan404ming
Copy link
Member Author

Thanks!

@guan404ming guan404ming deleted the add-decomposed-support-for-pad branch November 14, 2025 17:19
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