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
return obj
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:
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
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: mariogeiger/se3cnn
Commit Name: 2279ca536f544d1e7a841b708f213163b6a8d17b
Time: 2018-01-03
Author: geiger.mario@gmail.com
File Name: arch/example.py
Class Name: CNN
Method Name: __init__
Project Name: dpressel/mead-baseline
Commit Name: 509453992838a524f6442d4e0f07a034390ae1f7
Time: 2020-02-13
Author: dpressel@gmail.com
File Name: layers/eight_mile/pytorch/layers.py
Class Name: ConvEncoderStack
Method Name: __init__