MCPcopy Create free account
hub / github.com/LeCAR-Lab/model-based-diffusion / step

Method step

mbd/envs/hopper.py:36–47  ·  view source on GitHub ↗

Runs one timestep of the environment's dynamics.

(self, state: State, action: jax.Array)

Source from the content-addressed store, hash-verified

34 return State(pipeline_state, obs, reward, done, {})
35
36 def step(self, state: State, action: jax.Array) -> State:
37 """Runs one timestep of the environment's dynamics."""
38 pipeline_state0 = state.pipeline_state
39 assert pipeline_state0 is not None
40 pipeline_state = self.pipeline_step(pipeline_state0, action)
41
42 obs = self._get_obs(pipeline_state)
43 reward = self._get_reward(pipeline_state)
44
45 return state.replace(
46 pipeline_state=pipeline_state, obs=obs, reward=reward, done=0.0
47 )
48
49 def _get_obs(self, pipeline_state: base.State) -> jax.Array:
50 """Returns the environment observations."""

Callers

nothing calls this directly

Calls 2

_get_obsMethod · 0.95
_get_rewardMethod · 0.95

Tested by

no test coverage detected