Skip to content

Commit

Permalink
Manage empty arrays when checking spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
icub committed Oct 3, 2023
1 parent 263fa9e commit 9387b48
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/jaxgym/jax/pytree_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ def contains(self, x: jtp.PyTree) -> bool:

def is_inside_bounds(x, low, high):
return jax.lax.select(
pred=jnp.alltrue(
jnp.array([jnp.alltrue(x >= low), jnp.alltrue(x <= high)])
),
pred=x.size == 0 or jnp.all((x >= low) & (x <= high)),
on_true=True,
on_false=False,
)
Expand Down

0 comments on commit 9387b48

Please sign in to comment.