60f86864a6da5a746f9ae51f73ccfdeb29e6b35f,utils.py,Trainer,save,#Trainer#Any#,59

Before Change


        model_folder = "checkpoints/"
        model_out_path = model_folder + "model_epoch_{}.pth".format(epoch)
        state = {"epoch": epoch, "weight": self.model.state_dict()}
        if not os.path.exists(model_folder):
            os.makedirs(model_folder)
        torch.save(state, model_out_path)


// copied from pytorch"s master

After Change


                self.save(ep)

    def save(self, epoch, **kwargs):
        if self.save_dir is not None:
            model_out_path = Path(self.save_dir)
            state = {"epoch": epoch, "weight": self.model.state_dict()}
            if not model_out_path.exists():
                model_out_path.exists()
            torch.save(state, model_out_path / "model_epoch_{}.pth".format(epoch))


// copied from pytorch"s master
class _LRScheduler(object):
    def __init__(self, optimizer, last_epoch=-1):
        if not isinstance(optimizer, Optimizer):
            raise TypeError("{} is not an Optimizer".format(
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 8

Instances


Project Name: moskomule/senet.pytorch
Commit Name: 60f86864a6da5a746f9ae51f73ccfdeb29e6b35f
Time: 2018-03-06
Author: hataya@keio.jp
File Name: utils.py
Class Name: Trainer
Method Name: save


Project Name: YerevaNN/mimic3-benchmarks
Commit Name: 7567cc646d258e40dde9790a28a9b264ccd494fb
Time: 2017-08-27
Author: harhro@gmail.com
File Name: mimic3models/split_train_val.py
Class Name:
Method Name:


Project Name: YerevaNN/mimic3-benchmarks
Commit Name: 5d353701dd56a1fc8abc15e4082e33b7bed2a241
Time: 2017-08-09
Author: harhro@gmail.com
File Name: mimic3models/split_train_val.py
Class Name:
Method Name: