Skip to main content

reduce

Function reduce 

Source
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 caller
  • tensor - The tensor to send as input
  • root - 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.