MCPcopy Index your code
hub / github.com/pytorch/pytorch / _ForEachDevice

Function _ForEachDevice

caffe2/python/data_parallel_model.py:855–864  ·  view source on GitHub ↗
(devices, f, device_type, device_prefix, scoped=False,
                   *args, **kwargs)

Source from the content-addressed store, hash-verified

853
854
855def _ForEachDevice(devices, f, device_type, device_prefix, scoped=False,
856 *args, **kwargs):
857 for device in devices:
858 device_opt = core.DeviceOption(device_type, device)
859 with core.DeviceScope(device_opt):
860 if scoped:
861 with core.NameScope("{}_{}".format(device_prefix, device)):
862 f(device, *args, **kwargs)
863 else:
864 f(device, *args, **kwargs)
865
866
867def _AddGradientOperators(devices, model, losses_by_gpu):

Callers 1

Parallelize_BMUFFunction · 0.85

Calls 2

fFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…