Source code for torchrl.agents.gym_random_agent

from .base_agent import BaseAgent

[docs]class GymRandomAgent(BaseAgent): """Take random actions on a Gym environment. This is only tested on Classic Control environments from OpenAI Gym. It is only meant to get started working with new environments. """ @property def models(self) -> list: return [] @property def checkpoint(self) -> object: return None
[docs] def act(self, obs): return [[self.action_space.sample()] for _ in range(len(obs))]
[docs] def learn(self, *args, **kwargs): return {}