class_docstr: AllReduce StrategyBuilder.
  
  This StrategyBuilder generates a strategy that synchronizes every dense variable using AllReduce.
  It will sequentially merge collective ops into a single collective group based on chunk_size.
  
  This strategy does not support synchronizing sparse updates with >1 nodes due to the TF AllGather bug.
class_docstr_tok: ["AllReduce","StrategyBuilder",".","This","StrategyBuilder","generates","a","strategy","that","synchronizes","every","dense","variable","using","AllReduce",".","It","will","sequentially","merge","collective","ops","into","a","single","collective","group","based","on","chunk_size",".","This","strategy","does","not","support","synchronizing","sparse","updates","with",">","1","nodes","due","to","the","TF","AllGather","bug","."]
docstr: Init function.
  
  Args:
      chunk_size (int): chunk_size is a positive integer indicating how many variables will be merged
                        sequentially as a group by scoped allocator.
      all_reduce_spec (str): 'AUTO', 'NCCL', 'RING'.
      compressor (str): Gradient compression algorithm to use.
docstr_tok: ["Init","function",".","Args",":","chunk_size","(","int",")",":","chunk_size","is","a","positive","integer","indicating","how","many","variables","will","be","merged","sequentially","as","a","group","by","scoped","allocator",".","all_reduce_spec","(","str",")",":","'AUTO","'",",","'NCCL","'",",","'RING","'",".","compressor","(","str",")",":","Gradient","compression","algorithm","to","use","."]
code: def __init__(
      self,
      chunk_size=128,
      all_reduce_spec="NCCL",
      compressor="NoneCompressor",
  ):
      """
      Init function.
  
      Args:
          chunk_size (int): chunk_size is a positive integer indicating how many variables will be merged
                            sequentially as a group by scoped allocator.
          all_reduce_spec (str): 'AUTO', 'NCCL', 'RING'.
          compressor (str): Gradient compression algorithm to use.
      """
      if chunk_size < 1:
          raise ValueError("The chunk_size must be greater than zero.")
      self.chunk_size = chunk_size
      self.all_reduce_spec = all_reduce_spec
      self.compressor = compressor
  
imports: from autodist.strategy.base import Strategy, StrategyBuilder
  from autodist.proto import strategy_pb2, synchronizers_pb2
label_desc: Use image node_id 1 to create a new AllReduce object from inherited base classes: StrategyBuilder with example: obj = AllReduce(chunk_size, all_reduce_spec, compressor)