Skip to content
Snippets Groups Projects

Resolve "Implement Callback to track epoch-runtime"

Merged Ghost User requested to merge felix_issue312-callback-track-epoch-runtime into develop
1 file
+ 14
0
Compare changes
  • Side-by-side
  • Inline
@@ -8,6 +8,7 @@ import math
@@ -8,6 +8,7 @@ import math
import pickle
import pickle
from typing import Union, List
from typing import Union, List
from typing_extensions import TypedDict
from typing_extensions import TypedDict
 
from time import time
import numpy as np
import numpy as np
from keras import backend as K
from keras import backend as K
@@ -111,6 +112,19 @@ class LearningRateDecay(History):
@@ -111,6 +112,19 @@ class LearningRateDecay(History):
return K.get_value(self.model.optimizer.lr)
return K.get_value(self.model.optimizer.lr)
 
class TimingCallback(Callback):
 
def __init__(self):
 
self.logs = []
 
self.starttime = None
 
super().__init__()
 
 
def on_epoch_begin(self, logs={}):
 
self.starttime = time()
 
 
def on_epoch_end(self, logs={}):
 
self.logs.append(time()-self.starttime)
 
 
class ModelCheckpointAdvanced(ModelCheckpoint):
class ModelCheckpointAdvanced(ModelCheckpoint):
"""
"""
Enhance the standard ModelCheckpoint class by additional saves of given callbacks.
Enhance the standard ModelCheckpoint class by additional saves of given callbacks.
Loading