class_docstr: Client for ParameterServer.
  Supports store, accumulate, swap, swap-accumulate, and get operations.
class_docstr_tok: ["Client","for","ParameterServer",".","Supports","store",",","accumulate",",","swap",",","swap-accumulate",",","and","get","operations","."]
docstr: Get a tensor from the server.
code: def get(
      self,
      key: str,
      dst: Optional[torch.Tensor] = None,
      shared: bool = False,
  ) -> Optional[torch.Tensor]:
      """Get a tensor from the server."""
      self._validate_get(key, dst=dst, shared=shared)
      cmd_rpc = torch.tensor(
          [GET_CMD, len(key), dst is None, 0, 0, 0], dtype=torch.long
      )
      metadata_pg = self._metadata_pg()
      td.send(cmd_rpc, self.server_rank, group=metadata_pg)
      td.send(_fromstring(key), self.server_rank, group=metadata_pg)
      if dst is None:
          meta = torch.full((2,), -1, dtype=torch.long)
          td.recv(meta, src=self.server_rank, group=metadata_pg)
          ndim, ttype = meta
          if ndim.item() == -1:
              return None
          size = torch.full((ndim.item(),), -1, dtype=torch.long)
          td.recv(size, src=self.server_rank, group=metadata_pg)
          dtype = _dtypes[ttype.item()]
          if shared:
              dst = allocate_shared_tensor(size.tolist(), dtype=dtype)
          else:
              dst = torch.empty(size.tolist(), dtype=dtype)
      start_t = time.monotonic()
      data_pgs = self._data_pgs()
      if data_pgs is None:
          td.recv(dst, src=self.server_rank)
      else:
          outstanding_work = []
          flattened_dst = dst.flatten()
          flattened_size = flattened_dst.shape[0]
          for idx, (pg, slice_) in enumerate(
              zip(
                  data_pgs,
                  split_almost_equally(
                      flattened_size, num_parts=len(data_pgs)
                  ),
              )
          ):
              outstanding_work.append(
                  td.irecv(
                      tensor=flattened_dst[slice_],
                      src=self.server_rank,
                      group=pg,
                      tag=idx,
                  )
              )
          for w in outstanding_work:
              w.wait()
      end_t = time.monotonic()
      if self.log_stats:
          stats_size = dst.numel() * dst.element_size()
          stats_time = end_t - start_t
          logger.debug(
              f"Received tensor {key} from server {self.server_rank}: "
              f"{stats_size:,} bytes "
              f"in {stats_time:,g} seconds "
              f"=> {stats_size / stats_time:,.0f} B/s"
          )
      return dst
  
imports: import logging
  import multiprocessing
  import queue
  import time
  import traceback
  from functools import lru_cache
  from typing import Callable, Dict, List, Optional, Sequence
  import torch
  import torch.distributed
  import torch.multiprocessing
  from torchbiggraph.distributed import init_process_group, Startable
  from torchbiggraph.types import CharTensorType, Rank
  from torchbiggraph.util import allocate_shared_tensor, split_almost_equally, tag_logs_with_process_name
label_desc: Use image node_id 7 for calling the ParameterClient obj's underlying member method code with example usage: obj.get(key, dst, shared) and returns: dst, None