Skip to content

BUG: isclose: scalars cannot be input alongside non-default device arrays #478

@OmarManzoor

Description

@OmarManzoor

When we use isclose with array-api-strict while comparing an array on a device to a scalar value we get the error

ValueError: Arrays from two different devices (array_api_strict.Device('device1') and array_api_strict.Device('CPU_DEVICE')) can not be combined.

Here is a simple example to reproduce this:

import array_api_strict as xp
from array_api_extra import isclose

arr = xp.asarray([0.1, 0.2, 0.3, 0.4, 0.5], device=xp.Device("device1"))
isclose(arr, 1.0)

Can this be adjusted in the array_api_extra implementation to handle the necessary conversions so that we don't have to do them ourselves?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions