MCPcopy Create free account
hub / github.com/NVIDIA/semantic-segmentation / forward

Method forward

utils/my_data_parallel.py:179–190  ·  view source on GitHub ↗
(self, *inputs, **kwargs)

Source from the content-addressed store, hash-verified

177 self.module.cuda(device_ids[0])
178
179 def forward(self, *inputs, **kwargs):
180 if not self.device_ids:
181 return self.module(*inputs, **kwargs)
182 inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids)
183 if len(self.device_ids) == 1:
184 return [self.module(*inputs[0], **kwargs[0])]
185 replicas = self.replicate(self.module, self.device_ids[:len(inputs)])
186 outputs = self.parallel_apply(replicas, inputs, kwargs)
187 if self.gather_bool:
188 return self.gather(outputs, self.output_device)
189 else:
190 return outputs
191
192 def replicate(self, module, device_ids):
193 return replicate(module, device_ids)

Callers

nothing calls this directly

Calls 4

scatterMethod · 0.95
replicateMethod · 0.95
parallel_applyMethod · 0.95
gatherMethod · 0.95

Tested by

no test coverage detected