Skip to content

Commit 85b411e

Browse files
committed
require at least one jax array to reduce
1 parent bf9f852 commit 85b411e

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

effectful/handlers/jax/monoid.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,14 @@ def cartesian_prod(x, y):
5353

5454
def _jax_args(args):
5555
"""True iff ``args`` is non-empty and every arg is a concrete
56-
:class:`jax.typing.ArrayLike` or named tensor.
56+
:class:`jax.typing.ArrayLike` or named tensor. At least one argument must be
57+
a jax-related type.
58+
5759
"""
58-
return bool(args) and all(
59-
is_eager_array(a) or isinstance(a, jax.typing.ArrayLike) for a in args
60+
return (
61+
bool(args)
62+
and all(is_eager_array(a) or isinstance(a, jax.typing.ArrayLike) for a in args)
63+
and any(is_eager_array(a) or isinstance(a, jax.Array) for a in args)
6064
)
6165

6266

0 commit comments

Comments
 (0)