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

Before Change


    
    def __init__(self, module, device_ids=None, dim=0):
        super(ModelDataParallel, self).__init__()
        if device_ids is None:
            device_ids = list(range(torch.cuda.device_count()))
        self.dim = dim
        self.module = module
        self.device_ids = device_ids
        self.master_mean, self.master_var = {}, {}

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

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

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: 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: zhanghang1989/PyTorch-Encoding
Commit Name: 32e382bcb7cea782695cdf66001ed49ec0c2580a
Time: 2018-06-14
Author: 8041160+zhanghang1989@users.noreply.github.com
File Name: encoding/models/encnet.py
Class Name: EncModule
Method Name: __init__


Project Name: osmr/imgclsmob
Commit Name: 9963f2ded56fb471cd0597a3a64e99eaeb0d64ca
Time: 2021-02-11
Author: osemery@gmail.com
File Name: pytorch/pytorchcv/models/others/_linknet.py
Class Name: BasicBlock
Method Name: __init__