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)
docstr: Save snapshot of current batch.
  
  Args:
      epoch (int): Epoch.
  
  Raises:
      NotSetupError: if save() is called before the trainer is set up.
docstr_tok: ["Save","snapshot","of","current","batch",".","Args",":","epoch","(","int",")",":","Epoch",".","Raises",":","NotSetupError",":","if","save","(",")","is","called","before","the","trainer","is","set","up","."]
code: def save(self, epoch):
      """Save snapshot of current batch.
  
      Args:
          epoch (int): Epoch.
  
      Raises:
          NotSetupError: if save() is called before the trainer is set up.
  
      """
      if not self._has_setup:
          raise NotSetupError(
              "Use setup() to setup trainer before saving."
          )
  
      logger.log("Saving snapshot...")
  
      params = dict()
      # Save arguments
      params["seed"] = self._seed
      params["train_args"] = self._train_args
      params["stats"] = self._stats
  
      # Save states
      params["env"] = self._env
      params["algo"] = self._algo
      params["n_workers"] = self._n_workers
      params["worker_class"] = self._worker_class
      params["worker_args"] = self._worker_args
  
      self._snapshotter.save_itr_params(epoch, params)
  
      logger.log("Saved")
  
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 7 for calling the Trainer obj's underlying member method code with example usage: obj.save(epoch) without return types