bundles / scipy latest / scipy / _lib / _array_api / xp_compat_namespace
function
scipy._lib._array_api:xp_compat_namespace
source: build-install/usr/lib/python3.14/site-packages/scipy/_lib/_array_api.py:579
Signature
def xp_compat_namespace(xp: ModuleType | None) → ModuleTypeSummary
Return the array-api-compat(ible) namespace corresponding to xp.
Extended Summary
A user-provided xp may be a "raw" namespace (e.g. bare numpy or torch) that lacks features SciPy relies on (such as the device keyword of creation functions on CuPy <=14.1, xref cupy#9848); resolve it through array_namespace with a throwaway array. None maps to the compat NumPy namespace.
Aliases
scipy.signal._savitzky_golay.xp_compat_namespace