86cff17e7ef1b355e1ab4862ccd664ed4c856227,python/ray/util/sgd/torch/torch_trainer.py,TorchTrainer,get_model,#TorchTrainer#,498

Before Change


        if len(state["models"]) == 1:
            models.load_state_dict(state["models"][0])
        else:
            for model, state_dict in zip(models, state["models"]):
                model.load_state_dict(state_dict)
        return models

    def state_dict(self):
        return self.local_worker.get_state()

After Change


        unwrapped = []
        for model in self.local_worker.models:
            unwrapped += [model.module if hasattr(model, "module") else model]
        if len(unwrapped) == 1:
            return unwrapped[0]
        return unwrapped
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


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: keras-team/keras
Commit Name: ee179f7da155c3cb8129b954db828906886ad4e4
Time: 2015-06-08
Author: francois.chollet@gmail.com
File Name: keras/layers/core.py
Class Name: AutoEncoder
Method Name: get_output


Project Name: keras-team/autokeras
Commit Name: ae9083442dea9f4d318b261a58ee527daaf8dce1
Time: 2018-01-01
Author: jhfjhfj1@gmail.com
File Name: autokeras/graph.py
Class Name: Graph
Method Name: to_conv_wider_model


Project Name: asyml/texar
Commit Name: 42efaa53edce9b84a98fef1fce24502e6d2ba941
Time: 2017-12-08
Author: shore@pku.edu.cn
File Name: examples/transformer.py
Class Name:
Method Name: