class_docstr: A SessionRunHook handles ops related to SyncReplicasOptimizer.
code: def begin(self):
      if global_vars.SYNC_REPLICAS_OPTIMIZER is not None:
          self._sync_optimizer = global_vars.SYNC_REPLICAS_OPTIMIZER
      else:
          return
  
      if (
          self._sync_optimizer._gradients_applied is False
      ):  # pylint: disable=protected-access
          raise ValueError(
              "SyncReplicasOptimizer.apply_gradient should be called before using "
              "the hook."
          )
      if self.is_chief:
          self._local_init_op = self._sync_optimizer.chief_init_op
          self._ready_for_local_init_op = (
              self._sync_optimizer.ready_for_local_init_op
          )
          self._q_runner = self._sync_optimizer.get_chief_queue_runner()
          self._init_tokens_op = (
              self._sync_optimizer.get_init_tokens_op(self._num_tokens)
          )
      else:
          self._local_init_op = self._sync_optimizer.local_step_init_op
          self._ready_for_local_init_op = (
              self._sync_optimizer.ready_for_local_init_op
          )
          self._q_runner = None
          self._init_tokens_op = None
  
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 3 for calling the SyncReplicasOptimizerHook obj's underlying member method code with example usage: obj.begin() without return types