docstr: Exercises trainer code, checks that expected checkpoints are exported.
docstr_tok: ["Exercises","trainer","code",",","checks","that","expected","checkpoints","are","exported","."]
code: def testTrainerExportsCheckpoints(
      self,
      num_actions,
      observation_shape,
      action_shape,
      batch_size,
      training_loops,
      steps_per_loop,
      learning_rate,
  ):
      """Exercises trainer code, checks that expected checkpoints are exported."""
      root_dir = tempfile.mkdtemp(dir=os.getenv("TEST_TMPDIR"))
      environment = get_bounded_reward_random_environment(
          observation_shape, action_shape, batch_size, num_actions
      )
      agent = exp3_agent.Exp3Agent(
          learning_rate=learning_rate,
          time_step_spec=environment.time_step_spec(),
          action_spec=environment.action_spec(),
      )
      for i in range(1, 4):
          trainer.train(
              root_dir=root_dir,
              agent=agent,
              environment=environment,
              training_loops=training_loops,
              steps_per_loop=steps_per_loop,
          )
          latest_checkpoint = tf.train.latest_checkpoint(root_dir)
          expected_checkpoint_regex = ".*-{}".format(i * training_loops)
          self.assertRegex(latest_checkpoint, expected_checkpoint_regex)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import os
  import tempfile
  from unittest import mock
  from absl import logging
  from absl.testing import parameterized
  import tensorflow
  import tensorflow_probability
  from tf_agents.bandits.agents import exp3_agent
  from tf_agents.bandits.agents.examples.v2 import trainer
  from tf_agents.bandits.agents.examples.v2 import trainer_test_utils
  from tf_agents.bandits.environments import environment_utilities
  from tf_agents.bandits.environments import random_bandit_environment
  from tf_agents.bandits.environments import stationary_stochastic_py_environment
  from tf_agents.bandits.environments import wheel_py_environment
  from tf_agents.bandits.metrics import tf_metrics
  from tf_agents.environments import tf_py_environment
  from tf_agents.metrics import export_utils
  from tf_agents.specs import tensor_spec
label_desc: Use image node_id 1 for calling the TrainerTest obj's underlying member method code with example usage: obj.testTrainerExportsCheckpoints(num_actions, observation_shape, action_shape, batch_size, training_loops, steps_per_loop, learning_rate) without return types