array_namespace¶
- array_namespace(*arrays: Any) ModuleType[source][source]¶
Get the array API compatible namespace for the arrays xs.
- Parameters:
*arrays (
sequenceofarray_like) – Arrays used to infer the common namespace.- Returns:
namespace – Common namespace.
- Return type:
module
Notes
Thin wrapper around
array_api_compat.array_namespace.Check for the global switch: SCIPY_ARRAY_API. This can also be accessed dynamically through
_GLOBAL_CONFIG['SCIPY_ARRAY_API']._compliance_scipyraise exceptions on known-bad subclasses. See its definition for more details.
When the global switch is False, it defaults to the
numpynamespace. In that case, there is no compliance check. This is a convenience to ease the adoption. Otherwise, arrays must comply with the new rules.Examples
>>> import numpy as np >>> array_namespace(np.array([1, 2, 3])) <module '...numpy' from ...