a04525112543a5dbf77401cde45442932aeec368,foolbox/ext/native/models/pytorch.py,PyTorchModel,__init__,#PyTorchModel#Any#Any#Any#Any#,7

Before Change


        self._bounds = bounds

        if device is None:
            self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
        elif isinstance(device, str):
            self.device = torch.device(device)
        else:

After Change


        device = get_device(device)
        model = model.to(device)
        dummy = ep.torch.zeros(0, device=device)
        super().__init__(model, bounds, dummy, preprocessing=preprocessing)
        self.data_format = "channels_first"
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 4

Instances


Project Name: bethgelab/foolbox
Commit Name: a04525112543a5dbf77401cde45442932aeec368
Time: 2020-01-26
Author: git@jonasrauber.de
File Name: foolbox/ext/native/models/pytorch.py
Class Name: PyTorchModel
Method Name: __init__


Project Name: rtqichen/torchdiffeq
Commit Name: 7c6b9940261af254f033e05b914c336bbb8e7958
Time: 2020-08-04
Author: 33688385+patrick-kidger@users.noreply.github.com
File Name: tests/api_tests.py
Class Name:
Method Name:


Project Name: elbayadm/attn2d
Commit Name: 5b2be870f4008f54ccd145e10d4de24d2db9c1de
Time: 2019-08-01
Author: myleott@fb.com
File Name: fairseq/hub_utils.py
Class Name: Generator
Method Name: __init__