(x)
| 48 | |
| 49 | def get_array_namespace(*values): |
| 50 | def _get_single_namespace(x): |
| 51 | if hasattr(x, "__array_namespace__"): |
| 52 | return x.__array_namespace__() |
| 53 | elif isinstance(x, array_type("cupy")): |
| 54 | # cupy is fully compliant from xarray's perspective, but will not expose |
| 55 | # __array_namespace__ until at least v14. Special case it for now |
| 56 | import cupy as cp |
| 57 | |
| 58 | return cp |
| 59 | else: |
| 60 | return np |
| 61 | |
| 62 | namespaces = {_get_single_namespace(t) for t in values} |
| 63 | non_numpy = namespaces - {np} |
no test coverage detected
searching dependent graphs…