# Path: model/logger/step.py
# class StepLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step, last_step):
#         super().__init__(display_step)
# 
#         self._last_step_length = len(str(last_step))
# 
#     def after_display_step_run(self, run_context, run_values):
#         s = '[step {:0{}d}]'.format(self._step, self._last_step_length)
# 
#         print(s, end=' ')
# 
# Path: model/logger/time.py
# class TimeLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step, batch_size, last_step):
#         super().__init__(display_step)
# 
#         self._batch_size = batch_size
#         self._last_step = last_step
# 
#     def before_display_step_run(self, run_context):
#         self._start_time = time.time()
# 
#     def after_display_step_run(self, run_context, run_values):
#         duration = time.time() - self._start_time
#         remaining = (self._last_step - self._step) * duration / 60
#         examples_per_sec = self._batch_size / duration
# 
#         s = ', '.join([
#             '[{:.1f} examples/sec'.format(examples_per_sec),
#             '{:.2f} sec/batch'.format(duration),
#             '{:.1f} min remaining]'.format(remaining),
#             ])
# 
#         print(s, end=' ')
# 
# Path: model/logger/loss.py
# class LossLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step, loss):
#         super().__init__(display_step)
# 
#         self._loss = loss
# 
#     def before_display_step_run(self, run_context):
#         return tf.train.SessionRunArgs(self._loss)
# 
#     def after_display_step_run(self, run_context, run_values):
#         loss = run_values.results
# 
#         s = '[loss = {:.2f}]'.format(loss)
# 
#         print(s, end=' ')
# 
# Path: model/logger/accuracy.py
# class AccuracyLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step, accuracy):
#         super().__init__(display_step)
# 
#         self._accuracy = accuracy
# 
#     def before_display_step_run(self, run_context):
#         return tf.train.SessionRunArgs(self._accuracy)
# 
#     def after_display_step_run(self, run_context, run_values):
#         accuracy = run_values.results
# 
#         s = '[accuracy = {:.2f}]'.format(accuracy)
# 
#         print(s, end=' ')
# 
# Path: model/logger/eol.py
# class EolLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step):
#         super().__init__(display_step)
# 
#     def after_display_step_run(self, run_context, run_values):
#         print('')


import tensorflow as tf
from .logger import (StepLoggerHook,
                     LossLoggerHook,
                     AccuracyLoggerHook,
                     TimeLoggerHook,
                     EolLoggerHook)



def hooks(display_step, last_step, batch_size, loss, accuracy):
    return [
        tf.train.StopAtStepHook(last_step=last_step),
        tf.train.NanTensorHook(loss),
        StepLoggerHook(display_step, last_step),
        LossLoggerHook(display_step, loss),
        AccuracyLoggerHook(display_step, accuracy),

# Path: model/logger/step.py
# class StepLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step, last_step):
#         super().__init__(display_step)
# 
#         self._last_step_length = len(str(last_step))
# 
#     def after_display_step_run(self, run_context, run_values):
#         s = '[step {:0{}d}]'.format(self._step, self._last_step_length)
# 
#         print(s, end=' ')
# 
# Path: model/logger/time.py
# class TimeLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step, batch_size, last_step):
#         super().__init__(display_step)
# 
#         self._batch_size = batch_size
#         self._last_step = last_step
# 
#     def before_display_step_run(self, run_context):
#         self._start_time = time.time()
# 
#     def after_display_step_run(self, run_context, run_values):
#         duration = time.time() - self._start_time
#         remaining = (self._last_step - self._step) * duration / 60
#         examples_per_sec = self._batch_size / duration
# 
#         s = ', '.join([
#             '[{:.1f} examples/sec'.format(examples_per_sec),
#             '{:.2f} sec/batch'.format(duration),
#             '{:.1f} min remaining]'.format(remaining),
#             ])
# 
#         print(s, end=' ')
# 
# Path: model/logger/loss.py
# class LossLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step, loss):
#         super().__init__(display_step)
# 
#         self._loss = loss
# 
#     def before_display_step_run(self, run_context):
#         return tf.train.SessionRunArgs(self._loss)
# 
#     def after_display_step_run(self, run_context, run_values):
#         loss = run_values.results
# 
#         s = '[loss = {:.2f}]'.format(loss)
# 
#         print(s, end=' ')
# 
# Path: model/logger/accuracy.py
# class AccuracyLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step, accuracy):
#         super().__init__(display_step)
# 
#         self._accuracy = accuracy
# 
#     def before_display_step_run(self, run_context):
#         return tf.train.SessionRunArgs(self._accuracy)
# 
#     def after_display_step_run(self, run_context, run_values):
#         accuracy = run_values.results
# 
#         s = '[accuracy = {:.2f}]'.format(accuracy)
# 
#         print(s, end=' ')
# 
# Path: model/logger/eol.py
# class EolLoggerHook(LoggerHook):
# 
#     def __init__(self, display_step):
#         super().__init__(display_step)
# 
#     def after_display_step_run(self, run_context, run_values):
#         print('')


# Path: model/hooks.py
import tensorflow as tf
from .logger import (StepLoggerHook,
                     LossLoggerHook,
                     AccuracyLoggerHook,
                     TimeLoggerHook,
                     EolLoggerHook)




def hooks(display_step, last_step, batch_size, loss, accuracy):
    return [
        tf.train.StopAtStepHook(last_step=last_step),
        tf.train.NanTensorHook(loss),
        StepLoggerHook(display_step, last_step),
        LossLoggerHook(display_step, loss),
        AccuracyLoggerHook(display_step, accuracy),

        TimeLoggerHook(display_step, batch_size, last_step),