Repository navigation
fix: align non-float/complex ops, @ matmul, index keys, and TF creation dtypes - #53
Conversation
Drop branches no caller exercises: complex isfinite/isinf/isnan, TF bool sum/min/max, PyTorch uint8 any/all cast, and the tf.Tensor key conversion in TF set_item (numpy already accepts eager tensors). Simplify unwrap_key, keeping custom __index__ support for W[agent_i, agent_j] since TF and JAX reject such keys.
fix: align TF/PyTorch non-float ops, 1D matmul, custom index keys, and TF creation dtypes
|
looks good, thank you for catching these inconsistencies! can you please fix the issue that fails the mypy check? for your background: we are aligning with https://data-apis.org/array-api/latest/index.html. no change needed, since e.g. isfinite is as it should be |
|
also, since the change in mean fixes the issue in team-decent/decent-bench#362: can you please bump the version to 0.2.8 in this PR? then after I merge I'll make a release and we can update the dependency in decent-bench to use this new version, and fall back to using mean instead of the workaround you now have with sum |
|
Thanks for the review and the Array API pointer! Done — fixed the |
Fixes a few cross-backend inconsistencies found while integrating
decent-arrayin team-decent/decent-bench#362:PytorchBackend.mean/TensorflowBackend.mean: promote bool/int inputs to float instead of raising (PyTorch, TF bool) or truncating (TF int)TensorflowBackend.isfinite/isinf/isnan: return constant bools for int/bool inputs and check real/imag parts separately for complex inputsArray.__matmul__/__rmatmul__: delegate toself._backend.matmulso 1-D operands hitTensorflowBackend.matmul'stf.tensordotfallbackTensorflowBackend.empty/eye: default totf.float32, matchingzerosandonesunwrap_key: unwrapArraykeys and coerce custom__index__objects (e.g.W[agent_i, agent_j]) tointinget_item/set_itemacross backendsAdded cross-backend tests in
tests/test_array.pyandtests/test_iop_functions.py. All pytest and ruff checks pass across NumPy, PyTorch, TensorFlow, and JAX.