class_docstr: Test class for TRPO.
docstr: Test TRPO with Pendulum environment.
docstr_tok: ["Test","TRPO","with","Pendulum","environment","."]
code: def test_trpo_pendulum(self):
      """Test TRPO with Pendulum environment."""
      deterministic.set_seed(0)
      sampler = LocalSampler(
          agents=self.policy,
          envs=self.env,
          max_episode_length=self.env.spec.max_episode_length,
      )
      trainer = Trainer(snapshot_config)
      algo = TRPO(
          env_spec=self.env.spec,
          policy=self.policy,
          value_function=self.value_function,
          sampler=sampler,
          discount=0.99,
          gae_lambda=0.98,
      )
  
      trainer.setup(algo, self.env)
      last_avg_ret = trainer.train(n_epochs=10, batch_size=100)
      assert last_avg_ret > 0
  
file_path: garage/tests/garage/torch/algos/test_trpo.py
imports: import pytest
  import torch
  from garage.envs import GymEnv, normalize
  from garage.experiment import deterministic
  from garage.sampler import LocalSampler
  from garage.torch.algos import TRPO
  from garage.torch.policies import GaussianMLPPolicy
  from garage.torch.value_functions import GaussianMLPValueFunction
  from garage.trainer import Trainer
  from tests.fixtures import snapshot_config
label_desc: Use image node_id 3 for calling the TestTRPO obj's underlying member method code with example usage: obj.test_trpo_pendulum() without return types