code: def run_eval(
      root_dir: Text,
      # TODO(b/178225158): Deprecate in favor of the reporting libray when ready.
      return_reporting_fn: Optional[
          Callable[[int, float], None]
      ] = None,
  ) -> None:
      """Load the policy and evaluate it.
  
      Args:
        root_dir: the root directory for this experiment.
        return_reporting_fn: Optional callback function of the form `fn(train_step,
          average_return)` which reports the average return to a custom destination.
      """
      # Wait for the greedy policy to become available, then load it.
      greedy_policy_dir = os.path.join(
          root_dir,
          learner.POLICY_SAVED_MODEL_DIR,
          learner.GREEDY_POLICY_SAVED_MODEL_DIR,
      )
      policy = train_utils.wait_for_policy(
          greedy_policy_dir, load_specs_from_pbtxt=True
      )
  
      # Create the variable container. The weights of the greedy policy is updated
      # from it periodically.
      variable_container = (
          reverb_variable_container.ReverbVariableContainer(
              FLAGS.variable_container_server_address,
              table_names=[reverb_variable_container.DEFAULT_TABLE],
          )
      )
  
      # Prepare summary directory.
      summary_dir = os.path.join(
          FLAGS.root_dir, learner.TRAIN_DIR, "eval", str(FLAGS.task)
      )
  
      # Run the evaluation.
      evaluate(
          summary_dir=summary_dir,
          environment_name=gin.REQUIRED,
          policy=policy,
          variable_container=variable_container,
          return_reporting_fn=return_reporting_fn,
      )
  
imports: import functools
  import os
  from typing import Callable, Iterable, Optional, Sequence, Text
  from absl import app
  from absl import flags
  from absl import logging
  import gin
  from tf_agents.environments import py_environment
  from tf_agents.environments import suite_mujoco
  from tf_agents.experimental.distributed import reverb_variable_container
  from tf_agents.metrics import py_metric
  from tf_agents.metrics import py_metrics
  from tf_agents.policies import greedy_policy
  from tf_agents.policies import py_tf_eager_policy
  from tf_agents.system import system_multiprocessing
  from tf_agents.train import actor
  from tf_agents.train import learner
  from tf_agents.train.utils import train_utils
label_desc: Use image node_id 2 for calling a global function with example usage: run_eval(root_dir, return_reporting_fn) without return types