class_docstr: Stores state needed to perform the default communication algorithm within a communication hook.
  
  Args:
      process_group (ProcessGroup): The process group to be used.
class_docstr_tok: ["Stores","state","needed","to","perform","the","default","communication","algorithm","within","a","communication","hook",".","Args",":","process_group","(","ProcessGroup",")",":","The","process","group","to","be","used","."]
code: def __init__(self, process_group: dist.ProcessGroup):
      if process_group is None:
          raise ValueError(
              f"Expected to pass in an explicit ProcessGroup to {self}."
          )
      self.process_group = process_group
      self.world_size = dist.get_world_size(process_group)
      # Setting two factors `self.gradient_predivide_factor`
      # and `self.gradient_postdivide_factor` to avoid underflow and overflow
      self.gradient_predivide_factor = (
          self._get_gradient_predivide_factor(self.world_size)
      )
      self.gradient_postdivide_factor = (
          self.world_size / self.gradient_predivide_factor
      )
  
file_path: pytorch/torch/distributed/algorithms/_comm_hooks/default_hooks.py
imports: import functools
  import torch
  import torch.distributed
  from typing import Optional
label_desc: Use image node_id 1 to create a new DefaultState object  with example: obj = DefaultState(process_group)