class_docstr: Auxiliary data structure responsible for running asynchronous all-reduce
  :param part_shapes: a sequence of shapes of torch tensors that will be averaged by this reducer
  :param num_senders: total number of peers in a given all-reduce group that will send gradients
  :note: even if local peer is not sending data, local parts will be used for shape information
class_docstr_tok: ["Auxiliary","data","structure","responsible","for","running","asynchronous","all-reduce",":","param","part_shapes",":","a","sequence","of","shapes","of","torch","tensors","that","will","be","averaged","by","this","reducer",":","param","num_senders",":","total","number","of","peers","in","a","given","all-reduce","group","that","will","send","gradients",":","note",":","even","if","local","peer","is","not","sending","data",",","local","parts","will","be","used","for","shape","information"]
code: def __init__(
      self, part_shapes: Sequence[torch.Size], num_senders: int
  ):
      self.part_shapes, self.num_senders, self.num_parts = (
          part_shapes,
          num_senders,
          len(part_shapes),
      )
      self.current_part_index = (
          -1
      )  # index in local_parts of the part that should be loaded next
      self.current_part_accumulated_from = 0  # number of peers from which the current part was accumulated
      self.accumulator = None  # this will contain the sum of current tensor part from group peers
      self.denominator = 0.0  # total weight accumulated from all peers for current part
      self.current_part_future = asyncio.Future()
      self.finished = asyncio.Event()
  
      self.num_parts_received = [0 for _ in range(self.num_senders)]
      self.sender_failed_after = [
          float("inf") for _ in range(self.num_senders)
      ]
      self.num_current_senders = self.num_senders
  
      self.reset_accumulators()
  
imports: import asyncio
  from collections import deque
  from typing import AsyncIterable, AsyncIterator, Optional, Sequence, Tuple, TypeVar
  import numpy
  import torch
  from hivemind.compression import CompressionBase, CompressionInfo, NoCompression
  from hivemind.proto import runtime_pb2
  from hivemind.utils import amap_in_executor, as_aiter, get_logger
label_desc: Use image node_id 1 to create a new TensorPartReducer object  with example: obj = TensorPartReducer(part_shapes, num_senders)