Skip to content

Conversation

@vlad-perevezentsev
Copy link
Collaborator

After #2223 dpt.repeat() started raising an error when repeats is as 1D usm_ndarray

import dpctl.tensor as dpt

a = dpt.arange(8)
dpt.repeat(a, ind)

# repeats = int(repeats)
# TypeError: only 0-dimensional arrays can be converted to Python scalars

Previously this worked because int(repeats) was implicitly allowed for 1D usm_ndarrays

This PR updates dpt.repeat() to explicitly extract the single element from size-1 1D usm_ndarray repeats before converting it to a Python scalar and extends tests to cover both 0D and 1D repeats cases

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

@github-actions
Copy link

github-actions bot commented Jan 14, 2026

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

@github-actions
Copy link

Array API standard conformance tests for dpctl=0.22.0dev0=py310h93fe807_117 ran successfully.
Passed: 1116
Failed: 42
Skipped: 82

@coveralls
Copy link
Collaborator

Coverage Status

coverage: 86.248% (+0.003%) from 86.245%
when pulling cba240e on fix_repeat_scalar_conv
into 0797836 on master.

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

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

LGTM!

@vlad-perevezentsev vlad-perevezentsev merged commit 7960513 into master Jan 15, 2026
92 of 97 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.

3 participants