code: def make_actor_evaluator(
      environment_factory: Callable[[bool], dm_env.Environment],
      evaluator_network: actor_core_lib.FeedForwardPolicy,
  ) -> offline_distributed_layout.EvaluatorFactory:
      """Makes an evaluator that runs the agent on the environment.
  
      Args:
        environment_factory: Function that creates a dm_env.
        evaluator_network: Network to be use by the actor.
  
      Returns:
        actor_evaluator: Function that returns a Worker that will be executed
          by launchpad.
      """
  
      def actor_evaluator(
          random_key: networks_lib.PRNGKey,
          variable_source: core.VariableSource,
          counter: counting.Counter,
      ):
          """The evaluation process."""
          # Create the actor loading the weights from variable source.
          actor_core = (
              actor_core_lib.batched_feed_forward_to_actor_core(
                  evaluator_network
              )
          )
          # Inference happens on CPU, so it's better to move variables there too.
          variable_client = variable_utils.VariableClient(
              variable_source, "policy", device="cpu"
          )
          actor = actors.GenericActor(
              actor_core, random_key, variable_client, backend="cpu"
          )
  
          # Logger.
          logger = loggers.make_default_logger(
              "evaluator", steps_key="evaluator_steps"
          )
  
          # Create environment and evaluator networks
          environment = environment_factory(False)
  
          # Create logger and counter.
          counter = counting.Counter(counter, "evaluator")
  
          # Create the run loop and return it.
          return environment_loop.EnvironmentLoop(
              environment,
              actor,
              counter,
              logger,
          )
  
      return actor_evaluator
  
imports: import functools
  import operator
  from typing import Callable
  from acme import core
  from acme import environment_loop
  from acme import specs
  from acme import types
  from acme.agents.jax import actor_core
  from acme.agents.jax import actors
  from acme.agents.jax import bc
  from acme.agents.tf.dqfd import bsuite_demonstrations
  from acme.jax import networks
  from acme.jax import types
  from acme.jax import utils
  from acme.jax import variable_utils
  from acme.jax.deprecated import offline_distributed_layout
  from acme.utils import counting
  from acme.utils import loggers
  from acme.wrappers import single_precision
  import bsuite
  import dm_env
  import haiku
  import jax
  import jax.numpy
  from jax.scipy import special
  import rlax
  import tensorflow
  import tree
label_desc: Use image node_id 5 for calling a global function with example usage: make_actor_evaluator(environment_factory, evaluator_network) and returns: actor_evaluator, environment_loop