(self, count, metrics)
Callback to Show speed.
Callback to Show speed.
Callback to Show speed .
def __call__(self, count, metrics):
        """Callback to Show speed."""
        if self.last_count > count:
            self.init = False
        self.last_count = count

        if self.init:
            if count % self.frequent == 0:
                speed = self.frequent * self.batch_size / (time.time() - self.tic)
                if metrics is not None:
                    s = "Batch [%d]\tSpeed: %.2f samples/sec\tTrain-" % (count, speed)
                    for metric in metrics:
                        s += "%s=%f,\t" % (metric.get())
                else:
                    s = "Batch [%d]\tSpeed: %.2f samples/sec" % (count, speed)

                logging.info(s)
                self.tic = time.time()
        else:
            self.init = True
            self.tic = time.time()
def __call__ ( self , count , metrics ) : if self . last_count > count : self . init = False self . last_count = count if self . init : if count % self . frequent == 0 : speed = self . frequent * self . batch_size / ( time . time ( ) - self . tic ) if metrics is not None : s = "Batch [%d]\tSpeed: %.2f samples/sec\tTrain-" % ( count , speed ) for metric in metrics : s += "%s=%f,\t" % ( metric . get ( ) ) else : s = "Batch [%d]\tSpeed: %.2f samples/sec" % ( count , speed ) logging . info ( s ) self . tic = time . time ( ) else : self . init = True self . tic = time . time ( )