class_docstr: Sample Rainbow agent to visualize Q-values and rewards.
class_docstr_tok: ["Sample","Rainbow","agent","to","visualize","Q-values","and","rewards","."]
code: def reload_checkpoint(
      self, checkpoint_path, use_legacy_checkpoint=False
  ):
      if use_legacy_checkpoint:
          variables_to_restore = (
              atari_lib.maybe_transform_variable_names(
                  tf.compat.v1.global_variables(),
                  legacy_checkpoint_load=True,
              )
          )
      else:
          global_vars = set(
              [x.name for x in tf.compat.v1.global_variables()]
          )
          ckpt_vars = [
              "{}:0".format(name)
              for name, _ in tf.train.list_variables(checkpoint_path)
          ]
          include_vars = list(global_vars.intersection(set(ckpt_vars)))
          variables_to_restore = tf_slim.get_variables_to_restore(
              include=include_vars
          )
      if variables_to_restore:
          reloader = tf.compat.v1.train.Saver(
              var_list=variables_to_restore
          )
          reloader.restore(self._sess, checkpoint_path)
          logging.info("Done restoring from %s", checkpoint_path)
      else:
          logging.info("Nothing to restore!")
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  from absl import logging
  from dopamine.agents.dqn import dqn_agent
  from dopamine.agents.rainbow import rainbow_agent
  from dopamine.discrete_domains import atari_lib
  from dopamine.discrete_domains import iteration_statistics
  from dopamine.discrete_domains import run_experiment
  from dopamine.utils import agent_visualizer
  from dopamine.utils import atari_plotter
  from dopamine.utils import bar_plotter
  from dopamine.utils import line_plotter
  import gin
  import numpy
  import tensorflow
  import tf_slim
label_desc: Use image node_id 3 for calling the MyRainbowAgent obj's underlying member method code with example usage: obj.reload_checkpoint(checkpoint_path, use_legacy_checkpoint) without return types