MCPcopy Create free account
hub / github.com/pytorch/tutorials / gen_params

Function gen_params

advanced_source/pendulum.py:487–509  ·  view source on GitHub ↗

Returns a ``tensordict`` containing the physical parameters such as gravitational force and torque or speed limits.

(g=10.0, batch_size=None)

Source from the content-addressed store, hash-verified

485
486
487def gen_params(g=10.0, batch_size=None) -> TensorDictBase:
488 """Returns a ``tensordict`` containing the physical parameters such as gravitational force and torque or speed limits."""
489 if batch_size is None:
490 batch_size = []
491 td = TensorDict(
492 {
493 "params": TensorDict(
494 {
495 "max_speed": 8,
496 "max_torque": 2.0,
497 "dt": 0.05,
498 "g": g,
499 "m": 1.0,
500 "l": 1.0,
501 },
502 [],
503 )
504 },
505 [],
506 )
507 if batch_size:
508 td = td.expand(batch_size).contiguous()
509 return td
510
511
512######################################################################

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected