code: def get_train_hooks(name_list, use_tpu=False, **kwargs):
      """Factory for getting a list of TensorFlow hooks for training by name.
  
      Args:
        name_list: a list of strings to name desired hook classes. Allowed:
          LoggingTensorHook, ProfilerHook, ExamplesPerSecondHook, which are defined
          as keys in HOOKS
        use_tpu: Boolean of whether computation occurs on a TPU. This will disable
          hooks altogether.
        **kwargs: a dictionary of arguments to the hooks.
  
      Returns:
        list of instantiated hooks, ready to be used in a classifier.train call.
  
      Raises:
        ValueError: if an unrecognized name is passed.
      """
  
      if not name_list:
          return []
  
      if use_tpu:
          tf.compat.v1.logging.warning(
              "hooks_helper received name_list `{}`, but a "
              "TPU is specified. No hooks will be used.".format(
                  name_list
              )
          )
          return []
  
      train_hooks = []
      for name in name_list:
          hook_name = HOOKS.get(name.strip().lower())
          if hook_name is None:
              raise ValueError(
                  "Unrecognized training hook requested: {}".format(
                      name
                  )
              )
          else:
              train_hooks.append(hook_name(**kwargs))
  
      return train_hooks
  
file_path: autodist/examples/benchmark/utils/logs/hooks_helper.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
  from utils.logs import hooks
  from utils.logs import logger
  from utils.logs import metric_hook
label_desc: Use image node_id 1 for calling a global function with example usage: get_train_hooks(name_list, use_tpu) and returns: train_hooks, list, list