Skip to content
This repository was archived by the owner on Jul 13, 2026. It is now read-only.
This repository was archived by the owner on Jul 13, 2026. It is now read-only.

numba-dpex doesn't support zero-length array creation #1192

Description

@chudur-budur

If we look at dpnp and numpy, they support zero-length array creation (i.e. shape is 0)

>>> import numpy as np
>>> a = np.empty(0)
>>> a
array([], dtype=float64)
>>> import dpnp
>>> a = dpnp.empty(0)
>>> a
array([])

numba-dpex should do the same.

@dpjit
def foo():
    x = dpnp.empty(0)
    return x

a = foo()
print(a)

but it doesn't:

Traceback (most recent call last):
  File "/localdisk/work/$USER/numba-dpex/my-driver.py", line 20, in <module>
    a = bar()
MemoryError: USM allocation failed. Check the usm_type and queue.

This is applicable all other array creation functions, zeros(), ones(), etc.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions