torch.repeat cast short ints to int32#390
Merged
ev-br merged 2 commits intodata-apis:mainfrom Feb 17, 2026
Merged
Conversation
Otherwise, "repeat_interleave is not implemented for Char" etc.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements a workaround for PyTorch issue #151311 where torch.repeat_interleave rejects short integer dtypes (int8 and int16). The fix adds type casting logic to convert these dtypes to int32 before calling the underlying PyTorch function. The PR also removes corresponding xfail entries from test configuration files now that the tests are expected to pass.
Changes:
- Added dtype casting workaround in the
repeatfunction to convert int8/int16 tensors to int32 - Removed test xfails for
test_repeatfrom torch and numpy test configuration files
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| array_api_compat/torch/_aliases.py | Added dtype check and casting logic to convert int8/int16 repeats arguments to int32 before calling torch.repeat_interleave |
| torch-xfails.txt | Removed xfail entry and comment for test_repeat now that the workaround is implemented |
| numpy-xfails.txt | Removed xfail entry and comment for test_repeat (uint64 issue appears to be resolved in test suite) |
| numpy-dev-xfails.txt | Removed xfail entry and comment for test_repeat |
| numpy-1-26-xfails.txt | Removed xfail entry and comment for test_repeat |
| numpy-1-22-xfails.txt | Removed xfail entry and comment for test_repeat |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A workaround for pytorch/pytorch#151311
A matching test update is data-apis/array-api-tests#424