(self, epochs)
Call all registered callbacks' on_train_begin functions.

        Arguments:
            epochs (int): Total epochs
Call all registered callbacks' on_train_begin functions.
Call all registered callbacks on_train_begin functions .
def on_train_begin(self, epochs):
        """
        Call all registered callbacks' on_train_begin functions.

        Arguments:
            epochs (int): Total epochs
        """
        # data iterator wraps around to avoid partial minibatches
        # callbacks producing per-minibatch data need a way to preallocate buffers
        config = self.callback_data.create_group('config')

        total_minibatches = math.ceil(self.model().ndata / self.be.bsz) * epochs

        config.attrs['total_minibatches'] = total_minibatches

        config.attrs['total_epochs'] = epochs
        time_markers = self.callback_data.create_group("time_markers")
        time_markers.create_dataset("minibatch", (epochs,))
        if self.model_file:
            self.model().load_params(self.model_file)

        # setup an interrupt handler
        signal.signal(signal.SIGINT, self.on_sigint_catch)

        for c in self.callbacks:
            c.on_train_begin(self.callback_data, self.model(), epochs)
def on_train_begin ( self , epochs ) : # data iterator wraps around to avoid partial minibatches # callbacks producing per-minibatch data need a way to preallocate buffers config = self . callback_data . create_group ( 'config' ) total_minibatches = math . ceil ( self . model ( ) . ndata / self . be . bsz ) * epochs config . attrs [ 'total_minibatches' ] = total_minibatches config . attrs [ 'total_epochs' ] = epochs time_markers = self . callback_data . create_group ( "time_markers" ) time_markers . create_dataset ( "minibatch" , ( epochs , ) ) if self . model_file : self . model ( ) . load_params ( self . model_file ) # setup an interrupt handler signal . signal ( signal . SIGINT , self . on_sigint_catch ) for c in self . callbacks : c . on_train_begin ( self . callback_data , self . model ( ) , epochs )