docstr: Test-runs joint PPO on CartPole.
docstr_tok: ["Test-runs","joint","PPO","on","CartPole","."]
code: def test_jointppotrainer_cartpole(self):
      """Test-runs joint PPO on CartPole."""
  
      task = rl_task.RLTask(
          "CartPole-v0", initial_trajectories=0, max_steps=2
      )
      joint_model = functools.partial(
          models.PolicyAndValue,
          body=lambda mode: tl.Serial(tl.Dense(2), tl.Relu()),
      )
      lr = lambda: lr_schedules.multifactor(  # pylint: disable=g-long-lambda
          constant=1e-2,
          warmup_steps=100,
          factors="constant * linear_warmup",
      )
  
      trainer = actor_critic_joint.PPOJoint(
          task,
          joint_model=joint_model,
          optimizer=opt.Adam,
          lr_schedule=lr,
          batch_size=4,
          train_steps_per_epoch=2,
          n_trajectories_per_epoch=5,
      )
      trainer.run(2)
      self.assertEqual(2, trainer.current_epoch)
  
file_path: trax/trax/rl/actor_critic_joint_test.py
imports: import functools
  from absl.testing import absltest
  from trax import layers
  from trax import models
  from trax import optimizers
  from trax import test_utils
  from trax.rl import actor_critic_joint
  from trax.rl import task
  from trax.supervised import lr_schedules
label_desc: Use image node_id 3 for calling the ActorCriticJointTest obj's underlying member method code with example usage: obj.test_jointppotrainer_cartpole() without return types