Open
Description
I'm actually not sure if this is a bug. I actually don't know if ak.any
should work at all in such cases. I'm just noticing and inconsistent behavior between the cpu and jax backends even though ideally ak.any
should be called on boolean arrays.
To reproduce
In [1]: import awkward as ak
In [2]: ak.jax.register_and_check()
In [3]: ak.any(ak.Array([[1], [1, 2], [], [3, 4], [7]], backend="cpu"), axis=1)
Out[3]: <Array [True, True, False, True, True] type='5 * bool'>
In [4]: ak.any(ak.Array([[1], [1, 2], [], [3, 4], [7]], backend="jax"), axis=1)
WARNING:2025-04-13 19:20:37,179:jax._src.xla_bridge:967: An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.
Out[4]: <Array [True, True, True, True, True] type='5 * bool'>
It also yields incorrect length
In [1]: import awkward as ak
In [2]: ak.jax.register_and_check()
In [3]: ak.any(ak.Array([[], [1, 2], [], [3, 4], []], backend="cpu"), axis=1)
Out[3]: <Array [False, True, False, True, False] type='5 * bool'>
In [4]: ak.any(ak.Array([[], [1, 2], [], [3, 4], []], backend="jax"), axis=1)
WARNING:2025-04-13 19:17:46,219:jax._src.xla_bridge:967: An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.
Out[4]: <Array [True, True, True, True] type='4 * bool'>
but the current status of #3464 fixes that and only gives us incorrect values:
In [1]: import awkward as ak
In [2]: ak.jax.register_and_check()
In [3]: ak.any(ak.Array([[], [1, 2], [], [3, 4], []], backend="cpu"), axis=1)
Out[3]: <Array [False, True, False, True, False] type='5 * bool'>
In [4]: ak.any(ak.Array([[], [1, 2], [], [3, 4], []], backend="jax"), axis=1)
WARNING:2025-04-13 19:21:42,367:jax._src.xla_bridge:967: An NVIDIA GPU may be present on this machine, but a CUDA-enabled jaxlib is not installed. Falling back to cpu.
Out[4]: <Array [True, True, True, True, True] type='5 * bool'>