(self, dir_logs, name, model, optimizer)
Save a checkpoint

            Args:
                dir_logs: directory of the checkpoint
                name: name of the checkpoint
                model: model associated to the checkpoint
                optimizer: optimizer associated to the checkpoint
Save a checkpoint
Save a checkpoint
def save(self, dir_logs, name, model, optimizer):
        """ Save a checkpoint

            Args:
                dir_logs: directory of the checkpoint
                name: name of the checkpoint
                model: model associated to the checkpoint
                optimizer: optimizer associated to the checkpoint
        """
        path_template = os.path.join(dir_logs, 'ckpt_{}_{}.pth.tar')

        Logger()('Saving model...')
        model_state = model.state_dict()
        torch.save(model_state, path_template.format(name, 'model'))

        Logger()('Saving optimizer...')
        optimizer_state = optimizer.state_dict()
        torch.save(optimizer_state, path_template.format(name, 'optimizer'))

        Logger()('Saving engine...')
        engine_state = self.state_dict()
        torch.save(engine_state, path_template.format(name, 'engine'))
def save ( self , dir_logs , name , model , optimizer ) : path_template = os . path . join ( dir_logs , 'ckpt_{}_{}.pth.tar' ) Logger ( ) ( 'Saving model...' ) model_state = model . state_dict ( ) torch . save ( model_state , path_template . format ( name , 'model' ) ) Logger ( ) ( 'Saving optimizer...' ) optimizer_state = optimizer . state_dict ( ) torch . save ( optimizer_state , path_template . format ( name , 'optimizer' ) ) Logger ( ) ( 'Saving engine...' ) engine_state = self . state_dict ( ) torch . save ( engine_state , path_template . format ( name , 'engine' ) )