Skip to content

Commit

Permalink
fix dtype bug in Memory env (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
Howuhh authored Jul 12, 2024
1 parent d6757f2 commit f77c762
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/xminigrid/envs/minigrid/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ def step(
self, params: EnvParams, timestep: TimeStep[MemoryEnvCarry], action: IntOrArray
) -> TimeStep[MemoryEnvCarry]:
# disabling pick_up action
action = jax.lax.select(jnp.equal(action, 3), jnp.asarray(5, dtype=jnp.uint8), action)
action = jax.lax.select(
jnp.equal(action, 3),
jnp.asarray(5),
action,
).astype(jnp.uint8)

new_grid, new_agent, _ = take_action(timestep.state.grid, timestep.state.agent, action)

new_state = timestep.state.replace(grid=new_grid, agent=new_agent, step_num=timestep.state.step_num + 1)
Expand Down

0 comments on commit f77c762

Please sign in to comment.