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_placeholder(
      self,
      x: Union[torch.Tensor, float, str, None],
      device: torch.device,
      is_src: bool,
  ) -> Union[torch.Tensor, float, str]:
      encoded_msg_per_rank = self._encode_input_data(x, is_src)
      encoded_msg_all_ranks = self._do_all_reduce(
          torch.tensor(encoded_msg_per_rank, device=device), op="MAX"
      )
  
      if is_src:
          if x is None:
              raise RuntimeError(
                  "Internal error, x is None. Please, file an issue if you encounter this error."
              )
          return x
  
      encoded_msg = encoded_msg_all_ranks.cpu().tolist()
      return self._decode_as_placeholder(encoded_msg, device)
  
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 20 for calling the ComputationModel obj's underlying member method code with example usage: obj._setup_placeholder(x, device, is_src) and returns: self, x