8f8fbb9f6543a4ccaad53923d33647e7138d95ea,encoding/parallel.py,ModelDataParallel,__init__,#ModelDataParallel#Any#Any#Any#,50

Before Change


        self.module = module
        self.device_ids = device_ids
        self.master_mean, self.master_var = {}, {}
        if len(self.device_ids) == 1:
            self.module.cuda(device_ids[0])

    def forward(self, *inputs, **kwargs):

After Change



    if isinstance(obj, list) or isinstance(obj, tuple):
        results = map(get_a_var, obj)
        for result in results:
            if isinstance(result, Variable):
                return result
    if isinstance(obj, dict):
        results = map(get_a_var, obj.items())
        for result in results:
            if isinstance(result, Variable):
                return result
    return None


def my_parallel_apply(modules, inputs, kwargs_tup=None):
    assert len(modules) == len(inputs)
    if kwargs_tup:
        assert len(modules) == len(kwargs_tup)
    else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: zhanghang1989/PyTorch-Encoding
Commit Name: 8f8fbb9f6543a4ccaad53923d33647e7138d95ea
Time: 2017-10-15
Author: zhang.hang@rutgers.edu
File Name: encoding/parallel.py
Class Name: ModelDataParallel
Method Name: __init__


Project Name: facebookresearch/Horizon
Commit Name: 462a933b3defaf7f10a1e1023b9d81b5e92e3227
Time: 2020-02-29
Author: czxttkl@fb.com
File Name: ml/rl/models/seq2slate.py
Class Name: BaselineNet
Method Name: __init__


Project Name: reinforceio/tensorforce
Commit Name: 82a059d89d5f5ebc77c6a3f0b8ac4072a3979104
Time: 2018-08-03
Author: alexkuhnle@t-online.de
File Name: tensorforce/core/networks/layer.py
Class Name: Conv2d
Method Name: __init__