e304d4ee794a4cca8c116e52f99077ee71f87af1,mushroom/approximators/parametric/pytorch_network.py,PyTorchApproximator,predict,#PyTorchApproximator#,62

Before Change


            val = self._network.forward(*torch_args, **kwargs).detach().numpy()
        else:
            torch_args = [torch.from_numpy(x).cuda() for x in args]
            val = self._network.forward(*torch_args,
                                        **kwargs).detach().cpu().numpy()

        return val

After Change


        if not self._use_cuda:
            torch_args = [torch.from_numpy(x) for x in args]
            val = self._network.forward(*torch_args, **kwargs)
            if isinstance(val, tuple):
                val = tuple([x.detach().numpy() for x in val])
            else:
                val = val.detach().numpy()
        else:
            torch_args = [torch.from_numpy(x).cuda() for x in args]
            val = self._network.forward(*torch_args,
                                        **kwargs)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: AIRLab-POLIMI/mushroom
Commit Name: e304d4ee794a4cca8c116e52f99077ee71f87af1
Time: 2018-09-03
Author: carloderamo@gmail.com
File Name: mushroom/approximators/parametric/pytorch_network.py
Class Name: PyTorchApproximator
Method Name: predict


Project Name: rlworkgroup/garage
Commit Name: e4b6611cb73ef7658f028831be1aa6bd85ecbed0
Time: 2020-08-14
Author: 38871737+avnishn@users.noreply.github.com
File Name: src/garage/torch/policies/stochastic_policy.py
Class Name: StochasticPolicy
Method Name: get_action


Project Name: silvandeleemput/memcnn
Commit Name: 8e12624641eab7a7e73497ea96124bb39aca1c01
Time: 2020-03-04
Author: ce377@orthosie.damtp.cam.ac.uk
File Name: memcnn/models/revop.py
Class Name: InvertibleCheckpointFunction
Method Name: forward