def METHOD_NAME(self):
    self._global_step_tensor = training_util.get_global_step()
    if self._global_step_tensor is None:
        raise RuntimeError("Global step should be created to use StepCounterHook.")