47f5b88e8eddb8e35f7205fa2c4acde73188bf58,thinc/extra/wrappers.py,PytorchWrapper,to_gpu,#PytorchWrapper#Any#,56

Before Change



    def to_gpu(self, device_num):
        // TODO: Implement
        raise NotImplementedError

    def to_cpu(self):
        // TODO: Implement
        raise NotImplementedError

After Change


        self._model.load_state_dict(torch.load(filelike))

    def to_gpu(self, device_num):
        self._model.cuda(device_num)

    def to_cpu(self):
        self._model.cpu()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: explosion/thinc
Commit Name: 47f5b88e8eddb8e35f7205fa2c4acde73188bf58
Time: 2018-03-14
Author: honnibal+gh@gmail.com
File Name: thinc/extra/wrappers.py
Class Name: PytorchWrapper
Method Name: to_gpu


Project Name: pytorch/fairseq
Commit Name: 7633129ba8d5f0e28bd6b6d6027b14352482ef31
Time: 2019-01-04
Author: myleott@fb.com
File Name: fairseq/trainer.py
Class Name: Trainer
Method Name: __init__


Project Name: explosion/thinc
Commit Name: 31f7f9c33730fb68b7e7addb6ee6ccf2c3e94970
Time: 2018-03-14
Author: honnibal+gh@gmail.com
File Name: thinc/extra/wrappers.py
Class Name: PytorchWrapper
Method Name: to_gpu