(self, callback_data, model, epoch)
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
Called when an epoch is about to end
Called when an epoch is about to end
def on_epoch_end(self, callback_data, model, epoch):
        """
        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
        """
        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.)
                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
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. ) 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