MCPcopy Index your code
hub / github.com/pytorch/tutorials / simple_rollout

Function simple_rollout

advanced_source/pendulum.py:761–771  ·  view source on GitHub ↗
(steps=100)

Source from the content-addressed store, hash-verified

759
760
761def simple_rollout(steps=100):
762 # preallocate:
763 data = TensorDict({}, [steps])
764 # reset
765 _data = env.reset()
766 for i in range(steps):
767 _data["action"] = env.action_spec.rand()
768 _data = env.step(_data)
769 data[i] = _data
770 _data = step_mdp(_data, keep_other=True)
771 return data
772
773
774print("data from rollout:", simple_rollout(100))

Callers 1

pendulum.pyFile · 0.85

Calls 1

stepMethod · 0.80

Tested by

no test coverage detected