Skip to content

dpnp.allclose issues an error with scalars #2566

@abagusetty

Description

@abagusetty

Checks with allclose should have worked even with scalars using dpnp. Works for cupy and numpy

Error:

Traceback (most recent call last):
  File "/home/abagusetty/gpu4pyscf-testing/test_dpnp_allclose.py", line 9, in <module>
    dp.allclose(a, b)
  File "/home/abagusetty/gpu4pyscf-testing/dpnp/dpnp/dpnp_iface_logic.py", line 259, in allclose
    return all(isclose(a, b, rtol=rtol, atol=atol, equal_nan=equal_nan))
  File "/home/abagusetty/gpu4pyscf-testing/dpnp/dpnp/dpnp_iface_logic.py", line 868, in isclose
    dpnp.check_supported_arrays_type(a, b, scalar_type=True)
  File "/home/abagusetty/gpu4pyscf-testing/dpnp/dpnp/dpnp_iface.py", line 375, in check_supported_arrays_type
    raise TypeError(
TypeError: At least one input must be of supported array type, but got all scalars.

Reproducer:

import numpy as np
import dpnp as dp

a = np.float64(1.0)
b = np.float64(1.0)

np.allclose(a,b)
dp.allclose(a,b)

Metadata

Metadata

Assignees

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