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 before_run(self, _run_context):
      self._should_trigger = self._timer.should_trigger_for_step(
          self._iter_count
      )
      if self._should_trigger:
          fetches = {
              "predicted_tokens": self._pred_dict["predicted_tokens"],
              "target_words": self._pred_dict["labels.target_tokens"],
              "target_len": self._pred_dict["labels.target_len"],
          }
          return tf.train.SessionRunArgs([fetches, self._global_step])
      return tf.train.SessionRunArgs([{}, self._global_step])
  
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 4 for calling the TrainSampleHook obj's underlying member method code with example usage: obj.before_run(_run_context) and returns: tf, tf