File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -46,12 +46,16 @@ class NumPyReadOnly:
4646 """
4747 Variant of array_api_compat.numpy producing read-only arrays.
4848
49+ Read-only numpy arrays fail on `__iadd__` etc., whereas read-only libraries such as
50+ JAX and Sparse simply don't define those methods, which makes calls to `+=` fall
51+ back to `__add__`.
52+
4953 Note that this is not a full read-only Array API library. Notably,
50- array_namespace(x) returns array_api_compat.numpy, and as a consequence array
51- creation functions invoked internally by the tested functions will return
52- writeable arrays, as long as you don't explicitly pass xp=xp .
53- For this reason, tests that do pass xp=xp may misbehave and should be skipped
54- for NUMPY_READONLY.
54+ ` array_namespace(x)` returns array_api_compat.numpy. This is actually the desired
55+ behaviour, so that when a tested function internally calls `xp =
56+ array_namespace(*args) or xp`, it will internally create writeable arrays .
57+ For this reason, tests that explicitly pass xp=xp to the tested functions may
58+ misbehave and should be skipped for NUMPY_READONLY.
5559 """
5660
5761 def __getattr__ (self , name : str ) -> object : # numpydoc ignore=PR01,RT01
You can’t perform that action at this time.
0 commit comments