random#

Random Policy that samples actions uniformly from the action space.

Classes#

class prt_rl.common.policies.random.RandomPolicy(env_params: EnvParams | MultiAgentEnvParams)[source]#

Implements a policy that uniformly samples random actions.

This policy implements the Policy protocol so it can be used with any Collector or Evaluator in the PRT-RL framework.

Parameters:

env_params (EnvParams) – environment parameters

act(obs: Tensor, deterministic: bool = False) Tuple[Tensor, Dict[str, Tensor]][source]#

Randomly samples an action from action space.

Returns:

Tensordict with the “action” key added

Return type:

TensorDict