latest (dev)
Copy
Latest development documentation · Updated 2026-10-08
tensorplay.distributed.algorithms.ddp_comm_hooks.default_hooks.allreduce_hook
- tensorplay.distributed.algorithms.ddp_comm_hooks.default_hooks.allreduce_hook(process_group, bucket: GradBucket)[source]
Call
allreduceusingGradBuckettensors.Once gradient tensors are aggregated across all workers, its
thencallback takes the mean and returns the result.If user registers this DDP communication hook, DDP results is expected to be same as the case where no hook was registered. Hence, this won’t change behavior of DDP and user can use this as a reference or modify this hook to log useful information or any other purposes while unaffecting DDP behavior.
- Example::
>>> # xdoctest: +SKIP >>> ddp_model.register_comm_hook(process_group, allreduce_hook)
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?

