Distributed

class opacus.distributed.DifferentiallyPrivateDistributedDataParallel(model)[source]

Implements distributed data parallelism that is based on torch.distributed package at the module level.

Initializes internal Module state, shared by both nn.Module and ScriptModule.

forward(*args, **kwargs)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

opacus.distributed.average_gradients(model)[source]

For all parameters of a given model averages gradients over all workers

Parameters

model (Module) – model

Return type

None

Returns

None