hyri.interface.dist_util#
This file provides distributed tensor-gather helpers for channel-partitioned data.
Functions
Gather channel-partitioned tensors from all ranks to one destination rank. |
- hyri.interface.dist_util.gather_ch_to_tensor(tensor_ch_rank: Tensor, dest: int) Tensor | None#
Gather channel-partitioned tensors from all ranks to one destination rank.
Each rank may hold a different number of channels. Tensors are padded to a common channel count before gather, then trimmed and concatenated on the destination rank.
- Parameters:
tensor_ch_rank (torch.Tensor) – Local rank tensor with shape
(1, num_ch_rank, H, W).dest (int) – Destination rank that receives the concatenated tensor.
- Returns:
Concatenated tensor with shape
(1, total_num_ch, H, W)ondest;Noneon other ranks.- Return type:
Optional[torch.Tensor]
- Raises:
RuntimeError – If
torch.distributedis unavailable or not initialised.