The lru_cache docstring says:
Arguments to the cached function must be hashable.
But functions like
|
@lru_cache(100) |
|
def is_cupy_namespace(xp: Namespace) -> bool: |
take modules as arguments, which are not hashable.
Is this a problem? The is_*_array functions currently cast args to Hashable before calling another lru_cache-wrapped function:
|
cls = cast(Hashable, type(x)) |
|
return _issubclass_fast(cls, "ndonnx", "Array") |
cc @crusaderky
The
lru_cachedocstring says:But functions like
array-api-compat/array_api_compat/common/_helpers.py
Lines 340 to 341 in 9469947
take modules as arguments, which are not hashable.
Is this a problem? The
is_*_arrayfunctions currentlycastargs toHashablebefore calling anotherlru_cache-wrapped function:array-api-compat/array_api_compat/common/_helpers.py
Lines 190 to 191 in 9469947
cc @crusaderky