class_docstr: Base class of trainer.
  
  Use trainer.setup(algo, env) to setup algorithm and environment for trainer
  and trainer.train() to start training.
  
  Args:
      snapshot_config (garage.experiment.SnapshotConfig): The snapshot
          configuration used by Trainer to create the snapshotter.
          If None, it will create one with default settings.
  
  Note:
      For the use of any TensorFlow environments, policies and algorithms,
      please use TFTrainer().
  
  Examples:
      | # to train
      | trainer = Trainer()
      | env = Env(...)
      | policy = Policy(...)
      | algo = Algo(
      |         env=env,
      |         policy=policy,
      |         ...)
      | trainer.setup(algo, env)
      | trainer.train(n_epochs=100, batch_size=4000)
  
      | # to resume immediately.
      | trainer = Trainer()
      | trainer.restore(resume_from_dir)
      | trainer.resume()
  
      | # to resume with modified training arguments.
      | trainer = Trainer()
      | trainer.restore(resume_from_dir)
      | trainer.resume(n_epochs=20)
code: def __init__(self, snapshot_config):
      self._snapshotter = Snapshotter(
          snapshot_config.snapshot_dir,
          snapshot_config.snapshot_mode,
          snapshot_config.snapshot_gap,
      )
  
      self._has_setup = False
      self._plot = False
  
      self._seed = None
      self._train_args = None
      self._stats = ExperimentStats(
          total_itr=0,
          total_env_steps=0,
          total_epoch=0,
          last_episode=None,
      )
  
      self._algo = None
      self._env = None
      self._sampler = None
      self._plotter = None
  
      self._start_time = None
      self._itr_start_time = None
      self.step_itr = None
      self.step_episode = None
  
      # only used for off-policy algorithms
      self.enable_logging = True
  
      self._n_workers = None
      self._worker_class = None
      self._worker_args = None
  
imports: import copy
  import os
  import time
  import cloudpickle
  from dowel import logger, tabular
  from garage.experiment.deterministic import get_seed, set_seed
  from garage.experiment.experiment import dump_json
  from garage.experiment.snapshotter import Snapshotter
label_desc: Use image node_id 1 to create a new Trainer object  with example: obj = Trainer(snapshot_config)