def get_train_hooks(name_list, use_tpu=False, **kwargs):
    'Factory for getting a list of TensorFlow hooks for training by name.\n\n  Args:\n    name_list: a list of strings to name desired hook classes. Allowed:\n      LoggingTensorHook, ProfilerHook, ExamplesPerSecondHook, which are defined\n      as keys in HOOKS\n    use_tpu: Boolean of whether computation occurs on a TPU. This will disable\n      hooks altogether.\n    **kwargs: a dictionary of arguments to the hooks.\n\n  Returns:\n    list of instantiated hooks, ready to be used in a classifier.train call.\n\n  Raises:\n    ValueError: if an unrecognized name is passed.\n  '
    if (not name_list):
        return []
    if use_tpu:
        tf.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
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.
def get_train_hooks(name_list, use_tpu=False, **kwargs):
    'Factory for getting a list of TensorFlow hooks for training by name.\n\n  Args:\n    name_list: a list of strings to name desired hook classes. Allowed:\n      LoggingTensorHook, ProfilerHook, ExamplesPerSecondHook, which are defined\n      as keys in HOOKS\n    use_tpu: Boolean of whether computation occurs on a TPU. This will disable\n      hooks altogether.\n    **kwargs: a dictionary of arguments to the hooks.\n\n  Returns:\n    list of instantiated hooks, ready to be used in a classifier.train call.\n\n  Raises:\n    ValueError: if an unrecognized name is passed.\n  '
    if (not name_list):
        return []
    if use_tpu:
        tf.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