class_docstr: Tracks the progress of training and checks if training should stop.
class_docstr_tok: ["Tracks","the","progress","of","training","and","checks","if","training","should","stop","."]
code: def __call__(self, loss, sess):
      if self.sign * loss > self.sign * self.best:
          if FLAGS.log_progress:
              tf.logging.info(
                  "Previous best %s: %.4f.", self.label, self.best
              )
              tf.gfile.MakeDirs(os.path.dirname(self.save_path))
              self.saver.save(sess, self.save_path)
              tf.logging.info(
                  "Storing best model so far with loss %.4f at %s."
                  % (loss, self.save_path)
              )
          self.best = loss
          self.age = 0
          self.true_age = 0
      else:
          self.age += 1
          self.true_age += 1
          if self.age > self.patience:
              sess.run([self.decay_op])
              self.age = 0
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import time
  from magenta.models.coconet import lib_data
  from magenta.models.coconet import lib_graph
  from magenta.models.coconet import lib_hparams
  from magenta.models.coconet import lib_util
  import numpy
  import six
  from six.moves import range
  from six.moves import zip
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the Tracker obj's underlying member method code with example usage: obj.__call__(loss, sess) without return types