'Called when an epoch is about to end
Arguments:
callback_data (HDF5 dataset): shared data between callbacks
model (Model): model object
epoch (int): index of epoch that is ending'

def on_epoch_end(self, callback_data, model, epoch):

    if (not self.bn_layers):
        self.bn_layers = [l for l in model.layers_to_optimize if (type(l) is BatchNorm)]
    if (((epoch + 1) % self.epoch_freq) == 0):
        self.tune_set.reset()
        for (batch_idx, (x, t)) in enumerate(self.tune_set):
            for l in self.bn_layers:
                l.rho = (float(batch_idx) / (batch_idx + 1.0))
            model.fprop(x)
            model.layers.revert_tensors()
        debiaser = float(((batch_idx + 1.0) / batch_idx))
        for l in self.bn_layers:
            l.gvar[:] = (l.gvar * debiaser)
