Skip to content

torch.repeat cast short ints to int32#390

Merged
ev-br merged 2 commits intodata-apis:mainfrom
ev-br:torch_repeat_short_ints
Feb 17, 2026
Merged

torch.repeat cast short ints to int32#390
ev-br merged 2 commits intodata-apis:mainfrom
ev-br:torch_repeat_short_ints

Conversation

@ev-br
Copy link
Member

@ev-br ev-br commented Feb 17, 2026

A workaround for pytorch/pytorch#151311
A matching test update is data-apis/array-api-tests#424

Otherwise, "repeat_interleave is not implemented for Char" etc.
Copilot AI review requested due to automatic review settings February 17, 2026 19:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 repeat function to convert int8/int16 tensors to int32
  • Removed test xfails for test_repeat from 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.

@ev-br ev-br closed this Feb 17, 2026
@ev-br ev-br reopened this Feb 17, 2026
@ev-br ev-br merged commit c01c353 into data-apis:main Feb 17, 2026
49 of 62 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.

1 participant