# tensorplay.distributed.algorithms.ddp_comm_hooks.default_hooks.bf16_compress_hook Source: https://www.tensorplay.cn/docs/generated/tensorplay.distributed.algorithms.ddp_comm_hooks.default_hooks.bf16_compress_hook.html ```python tensorplay.distributed.algorithms.ddp_comm_hooks.default_hooks.bf16_compress_hook(process_group, bucket) ``` Warning: This API is experimental, and it requires NCCL version later than 2.9.6. This DDP communication hook implements a simple gradient compression approach that casts GradBucket tensor to half-precision [Brain floating point format](https://en.wikipedia.org/wiki/Bfloat16_floating-point_format) (tensorplay.bfloat16) and then divides it by the process group size. It allreduces those bfloat16 gradient tensors. Once compressed gradient tensors are allreduced, the chained callback decompress casts it back to the input data type (such as float32). Example:: ``` >>> # xdoctest: +SKIP >>> ddp_model.register_comm_hook(process_group, bf16_compress_hook) ```