docstr: Perform accumulators initialization when entering an evaluation phase, and signal dumping when exiting an
  evaluation phase. Entering or exiting the evaluation phase is determined according to the new phase given
  by val, and by the current phase set in self.phase.
  
  :param val: The new phase to change to
  :return: None
docstr_tok: ["Perform","accumulators","initialization","when","entering","an","evaluation","phase",",","and","signal","dumping","when","exiting","an","evaluation","phase",".","Entering","or","exiting","the","evaluation","phase","is","determined","according","to","the","new","phase","given","by","val",",","and","by","the","current","phase","set","in","self.phase",".",":","param","val",":","The","new","phase","to","change","to",":","return",":","None"]
code: def reset_evaluation_state(self, val: RunPhase) -> None:
      """
      Perform accumulators initialization when entering an evaluation phase, and signal dumping when exiting an
      evaluation phase. Entering or exiting the evaluation phase is determined according to the new phase given
      by val, and by the current phase set in self.phase.
  
      :param val: The new phase to change to
      :return: None
      """
      starting_evaluation = val == RunPhase.TEST
      ending_evaluation = self.phase == RunPhase.TEST
  
      if starting_evaluation:
          self.accumulated_rewards_across_evaluation_episodes = 0
          self.accumulated_shaped_rewards_across_evaluation_episodes = 0
          self.num_successes_across_evaluation_episodes = 0
          self.num_evaluation_episodes_completed = 0
  
          if self.ap.task_parameters.evaluate_only is None:
              # TODO verbosity was mistakenly removed from task_parameters on release 0.11.0, need to bring it back
              # if self.ap.is_a_highest_level_agent or self.ap.task_parameters.verbosity == "high":
              if self.ap.is_a_highest_level_agent:
                  screen.log_title(
                      "{}: Starting evaluation phase".format(self.name)
                  )
  
      elif ending_evaluation:
          # we write to the next episode, because it could be that the current episode was already written
          # to disk and then we won't write it again
          self.agent_logger.set_current_time(
              self.get_current_time() + 1
          )
  
          evaluation_reward = (
              self.accumulated_rewards_across_evaluation_episodes
              / self.num_evaluation_episodes_completed
          )
          self.agent_logger.create_signal_value(
              "Evaluation Reward", evaluation_reward
          )
          self.agent_logger.create_signal_value(
              "Shaped Evaluation Reward",
              self.accumulated_shaped_rewards_across_evaluation_episodes
              / self.num_evaluation_episodes_completed,
          )
          success_rate = (
              self.num_successes_across_evaluation_episodes
              / self.num_evaluation_episodes_completed
          )
          self.agent_logger.create_signal_value(
              "Success Rate", success_rate
          )
  
          if self.ap.task_parameters.evaluate_only is None:
              # TODO verbosity was mistakenly removed from task_parameters on release 0.11.0, need to bring it back
              # if self.ap.is_a_highest_level_agent or self.ap.task_parameters.verbosity == "high":
              if self.ap.is_a_highest_level_agent:
                  screen.log_title(
                      "{}: Finished evaluation phase. Success rate = {}, Avg Total Reward = {}".format(
                          self.name,
                          np.round(success_rate, 2),
                          np.round(evaluation_reward, 2),
                      )
                  )
  
imports: import copy
  import random
  from collections import OrderedDict
  from typing import Dict, List, Union, Tuple
  import numpy
  from six.moves import range
  from rl_coach.agents.agent_interface import AgentInterface
  from rl_coach.architectures.network_wrapper import NetworkWrapper
  from rl_coach.base_parameters import AgentParameters, Device, DeviceType, DistributedTaskParameters, Frameworks
  from rl_coach.core_types import RunPhase, PredictionType, EnvironmentEpisodes, ActionType, Batch, Episode, StateType
  from rl_coach.core_types import Transition, ActionInfo, TrainingSteps, EnvironmentSteps, EnvResponse
  from rl_coach.logger import screen, Logger, EpisodeLogger
  from rl_coach.memories.episodic.episodic_experience_replay import EpisodicExperienceReplay
  from rl_coach.saver import SaverCollection
  from rl_coach.spaces import SpacesDefinition, VectorObservationSpace, GoalsSpace, AttentionActionSpace
  from rl_coach.utils import Signal, force_list
  from rl_coach.utils import dynamic_import_and_instantiate_module_from_params
  from rl_coach.memories.backend.memory_impl import get_memory_backend
  from rl_coach.core_types import TimeTypes
  from rl_coach.off_policy_evaluators.ope_manager import OpeManager
  from rl_coach.core_types import PickledReplayBuffer, CsvDataset
label_desc: Use image node_id 14 for calling the Agent obj's underlying member method code with example usage: obj.reset_evaluation_state(val) without return types