60dfcf812eca79017dced46e1189245c050a3fd6,utils/factory.py,UtilsFactory,unpack_checkpoint,#Any#Any#Any#Any#Any#,241

Before Change



        if optimizer is not None:
            for key in optimizer:
                optimizer[key].load_state_dict(
                    checkpoint["optimizer_" + str(key) + "_state_dict"])

        if scheduler is not None:
            for key in scheduler:
                scheduler[key] = checkpoint["scheduler_" + str(key)]

After Change


            else:
                model.load_state_dict(checkpoint["model_state_dict"])

        for dict2load, name2load in zip(
                [criterion, optimizer, scheduler],
                ["criterion", "optimizer", "scheduler"]):
            if dict2load is None:
                continue

            if isinstance(dict2load, dict):
                for key, value in dict2load.items():
                    if value is not None:
                        name2load_ = f"{name2load}_{key}_state_dict"
                        value.load_state_dict(checkpoint[name2load_])
            else:
                name2load = f"{name2load}_state_dict"
                dict2load.load_state_dict(checkpoint[name2load])
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: Scitator/catalyst
Commit Name: 60dfcf812eca79017dced46e1189245c050a3fd6
Time: 2018-12-10
Author: scitator@gmail.com
File Name: utils/factory.py
Class Name: UtilsFactory
Method Name: unpack_checkpoint


Project Name: ray-project/ray
Commit Name: 86cff17e7ef1b355e1ab4862ccd664ed4c856227
Time: 2020-03-30
Author: rliaw@berkeley.edu
File Name: python/ray/util/sgd/torch/torch_trainer.py
Class Name: TorchTrainer
Method Name: get_model


Project Name: Microsoft/nni
Commit Name: 73b2221b5eb4fd21802e6bf41e21d5df8ef9bf2c
Time: 2019-11-22
Author: v-yugzh@microsoft.com
File Name: src/sdk/pynni/nni/nas/pytorch/darts/trainer.py
Class Name: DartsTrainer
Method Name: _compute_hessian