pub fn reduce<B: Backend>(
id: PeerId,
tensor: B::FloatTensorPrimitive,
op: ReduceOperation,
root: PeerId,
) -> Result<Option<B::FloatTensorPrimitive>, CollectiveError>Expand description
Reduces a tensor onto one device.
id- The peer id of the callertensor- The tensor to send as inputroot- The ID of the peer that will receive the result.
Returns Ok(None) if the root tensor is not the caller. Otherwise, returns the reduced tensor.