Skip to content

BUG: torch.arange: dtype=torch.complex64 fails #404

@lucascolley

Description

@lucascolley
scipy/sparse/linalg/_isolve/tests/test_iterative.py:93: in xp_case
    xp.arange(np.prod(A_shape), dtype=A.dtype),
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        A          = tensor([[7.5234+4.5699e-17j, 5.4298-1.0201e-01j, 5.9857-7.2208e-01j,
         6.1996-9.8623e-01j, 6.1057+1.5862e-01j, ....1225-8.6625e-01j,
         5.4780-2.8882e+00j, 4.0053-1.2447e+00j, 5.7663+5.4772e-17j]],
       dtype=torch.complex64)
        A_shape    = (5, 9, 9)
        batch_A    = (5,)
        batch_b    = (0, 1)
        case       = <rand-cmplx-sym-pd-F-cg>
        xp         = <module 'scipy._external.array_api_compat.torch' from '/Users/lucascolley/ghq/github.com/scipy/scipy/build-cpu-install/usr/lib/python3.13/site-packages/scipy/_external/array_api_compat/torch/__init__.py'>
scipy/_external/array_api_compat/torch/_aliases.py:620: in arange
    return torch.arange(start, stop, step, dtype=dtype, device=device, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        device     = None
        dtype      = torch.complex64
        kwargs     = {}
        start      = 0
        step       = 1
        stop       = np.int64(405)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <torch.utils._device.DeviceContext object at 0x116e05d30>
func = <built-in method arange of type object at 0x126a7b600>, types = (), args = (0, np.int64(405), 1)
kwargs = {'device': device(type='cpu'), 'dtype': torch.complex64}

    def __torch_function__(self, func, types, args=(), kwargs=None):
        kwargs = kwargs or {}
        if func in _device_constructors() and kwargs.get("device") is None:
            kwargs["device"] = self.device
>       return func(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^
E       NotImplementedError: "arange_cpu" not implemented for 'ComplexFloat'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions