class_docstr: Base class for distributed computation models and defines interface methods.
  This class is public and should be used for other custom derived distributed models.
class_docstr_tok: ["Base","class","for","distributed","computation","models","and","defines","interface","methods",".","This","class","is","public","and","should","be","used","for","other","custom","derived","distributed","models","."]
code: def _setup_attrs(self) -> None:
      if self._nproc_per_node is None:
          self._nproc_per_node = (
              self._compute_nproc_per_node()
              if self.get_world_size() > 1
              else 1
          )
      if self._nnodes is None:
          self._nnodes = self.get_world_size() // self._nproc_per_node
      if self._node is None:
          self._node = self.get_rank() // self._nproc_per_node
  
imports: from abc import ABCMeta, abstractmethod
  from numbers import Number
  from typing import Any, Callable, cast, List, Optional, Union
  import torch
  from packaging.version import Version
label_desc: Use image node_id 2 for calling the ComputationModel obj's underlying member method code with example usage: obj._setup_attrs() without return types