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

Method step

mbd/envs/cartpole.py:40–48  ·  view source on GitHub ↗

Run one timestep of the environment's dynamics.

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

Source from the content-addressed store, hash-verified

38 return State(pipeline_state, obs, reward, done, metrics)
39
40 def step(self, state: State, action: jax.Array) -> State:
41 """Run one timestep of the environment's dynamics."""
42 pipeline_state = self.pipeline_step(state.pipeline_state, action)
43 obs = self._get_obs(pipeline_state)
44 reward = jp.cos(pipeline_state.q[1]) - jp.abs(pipeline_state.qd[0])
45 done = 0.0
46 return state.replace(
47 pipeline_state=pipeline_state, obs=obs, reward=reward, done=done
48 )
49
50 @property
51 def action_size(self):

Callers

nothing calls this directly

Calls 1

_get_obsMethod · 0.95

Tested by

no test coverage detected