class_docstr: Occasionally samples predictions from the training run and prints them.
  
  Params:
    every_n_secs: Sample predictions every N seconds.
      If set, `every_n_steps` must be None.
    every_n_steps: Sample predictions every N steps.
      If set, `every_n_secs` must be None.
    sample_dir: Optional, a directory to write samples to.
    delimiter: Join tokens on this delimiter. Defaults to space.
code: def __init__(self, params, model_dir, run_config):
      super(TrainSampleHook, self).__init__(
          params, model_dir, run_config
      )
      self._sample_dir = os.path.join(self.model_dir, "samples")
      self._timer = SecondOrStepTimer(
          every_secs=self.params["every_n_secs"],
          every_steps=self.params["every_n_steps"],
      )
      self._pred_dict = {}
      self._should_trigger = False
      self._iter_count = 0
      self._global_step = None
      self._source_delimiter = self.params["source_delimiter"]
      self._target_delimiter = self.params["target_delimiter"]
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import abc
  import os
  import numpy
  import six
  import yaml
  import tensorflow
  from tensorflow.python.training.basic_session_run_hooks import SecondOrStepTimer
  from tensorflow.python.training import session_manager
  from tensorflow.python.client import timeline
  from tensorflow import gfile
  from seq2seq.configurable import Configurable, abstractstaticmethod
  from seq2seq import graph_utils, global_vars
label_desc: Use image node_id 1 to create a new TrainSampleHook object from inherited base classes: TrainingHook with example: obj = TrainSampleHook(params, model_dir, run_config)