{ } Raw JSON

bundles / scipy 1.18.0 / scipy / _external / array_api_compat / common / _helpers / is_torch_array

function

scipy._external.array_api_compat.common._helpers:is_torch_array

source: /scipy/_external/array_api_compat/common/_helpers.py:149

Signature

def is_torch_array(x: object) → TypeIs[torch.Tensor]

Summary

Return True if x is a PyTorch tensor.

Extended Summary

This function does not import PyTorch if it has not already been imported and is therefore cheap to use.

See also

array_namespace
is_array_api_obj
is_cupy_array
is_dask_array
is_jax_array
is_numpy_array
is_pydata_sparse_array

Aliases

  • scipy.differentiate.xpx._lib._at.is_torch_array