Skip to content

conj, real, and imag not found in array_api_compat.torch #186

Closed
@asmeurer

Description

@asmeurer

Running the tests against array_api_compat.torch (with #184 and data-apis/array-api-compat#38) I get several errors like

FAILED array_api_tests/test_operators_and_elementwise_functions.py::test_conj - AttributeError: module 'array_api_tests._array_module' has no attribute 'conj'
FAILED array_api_tests/test_operators_and_elementwise_functions.py::test_imag - AttributeError: module 'array_api_tests._array_module' has no attribute 'imag'
FAILED array_api_tests/test_operators_and_elementwise_functions.py::test_real - AttributeError: module 'array_api_tests._array_module' has no attribute 'real'

Here's what the failure looks like

_______________________________________________________________________________ test_imag _______________________________________________________________________________

    @given(xps.arrays(dtype=xps.complex_dtypes(), shape=hh.shapes()))
>   def test_imag(x):

array_api_tests/test_operators_and_elementwise_functions.py:1092:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

x = tensor([], dtype=torch.complex64)

    @given(xps.arrays(dtype=xps.complex_dtypes(), shape=hh.shapes()))
    def test_imag(x):
>       out = xp.imag(x)
E       AttributeError: module 'array_api_tests._array_module' has no attribute 'imag'
E       Falsifying example: test_imag(
E           x=tensor([], dtype=torch.complex64),
E       )

array_api_tests/test_operators_and_elementwise_functions.py:1093: AttributeError

But these functions are in the namespace:

>>> import array_api_compat.torch
>>> array_api_compat.torch.conj
<built-in method conj of type object at 0x10f8b2be0>
>>> array_api_compat.torch.real
<built-in method real of type object at 0x10f8b2be0>
>>> array_api_compat.torch.imag
<built-in method imag of type object at 0x10f8b2be0>

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