class_docstr: Visualizes episodes of the policy as it trains.
  
  Usually, this class is used by sending plot=True to Trainer.train().
  
  Args:
      env (garage.Environment): Environment from which to visualize episodes.
          This will be used without copying in the current process but in a
          separate thread, so it should be given a unique copy (in
          particular, do not pass the training environment here, then try to
          pickle it, or you will occasionally get crashes).
      policy (garage.tf.Policy): Policy used to visualize episodes.
      sess (tf.Session): The TensorFlow session to use.
      graph (tf.Graph): The TensorFlow graph to use.
      rollout (callable): The rollout function to call.
class_docstr_tok: ["Visualizes","episodes","of","the","policy","as","it","trains",".","Usually",",","this","class","is","used","by","sending","plot=True","to","Trainer.train","(",")",".","Args",":","env","(","garage.Environment",")",":","Environment","from","which","to","visualize","episodes",".","This","will","be","used","without","copying","in","the","current","process","but","in","a","separate","thread",",","so","it","should","be","given","a","unique","copy","(","in","particular",",","do","not","pass","the","training","environment","here",",","then","try","to","pickle","it",",","or","you","will","occasionally","get","crashes",")",".","policy","(","garage.tf.Policy",")",":","Policy","used","to","visualize","episodes",".","sess","(","tf.Session",")",":","The","TensorFlow","session","to","use",".","graph","(","tf.Graph",")",":","The","TensorFlow","graph","to","use",".","rollout","(","callable",")",":","The","rollout","function","to","call","."]
code: def __init__(
      self, env, policy, sess=None, graph=None, rollout=default_rollout
  ):
      Plotter.__plotters.append(self)
      self._env = env
      self.sess = tf.compat.v1.Session() if sess is None else sess
      self.graph = (
          tf.compat.v1.get_default_graph() if graph is None else graph
      )
      with self.sess.as_default(), self.graph.as_default():
          self._policy = policy.clone("plotter_policy")
      self.rollout = rollout
      self.worker_thread = Thread(
          target=self._start_worker, daemon=True
      )
      self.queue = Queue()
  
      # Needed in order to draw glfw window on the main thread
      if "Darwin" in platform.platform():
          self.rollout(
              self._env,
              self._policy,
              max_episode_length=np.inf,
              animated=True,
          )
  
file_path: garage/src/garage/tf/plotter/plotter.py
imports: import atexit
  from collections import namedtuple
  from enum import Enum
  import platform
  from queue import Queue
  from threading import Thread
  import numpy
  import tensorflow
  from garage import rollout
label_desc: Use image node_id 1 to create a new Plotter object  with example: obj = Plotter(env, policy, sess, graph, rollout)