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: Store or accumulate a tensor on the server.
code: def store(
      self,
      key: str,
      src: torch.Tensor,
      accum: bool = False,
      overwrite: bool = True,
  ) -> None:
      """Store or accumulate a tensor on the server."""
      self._validate_store(key, src, accum=accum, overwrite=overwrite)
      cmd_rpc = torch.tensor(
          [
              STORE_CMD,
              len(key),
              -1 if accum else src.ndimension(),
              int(accum),
              int(overwrite),
              _dtypes.index(src.dtype),
          ],
          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 not accum:
          td.send(
              torch.tensor(list(src.size()), dtype=torch.long),
              self.server_rank,
              group=metadata_pg,
          )
      start_t = time.monotonic()
      data_pgs = self._data_pgs()
      if data_pgs is None:
          td.send(src, dst=self.server_rank)
      else:
          outstanding_work = []
          flattened_src = src.flatten()
          flattened_size = flattened_src.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.isend(
                      tensor=flattened_src[slice_],
                      dst=self.server_rank,
                      group=pg,
                      tag=idx,
                  )
              )
          for w in outstanding_work:
              w.wait()
      end_t = time.monotonic()
      if self.log_stats:
          stats_size = src.numel() * src.element_size()
          stats_time = end_t - start_t
          logger.debug(
              f"Sent tensor {key} to server {self.server_rank}: "
              f"{stats_size:,} bytes "
              f"in {stats_time:,g} seconds "
              f"=> {stats_size / stats_time:,.0f} B/s"
          )
  
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 5 for calling the ParameterClient obj's underlying member method code with example usage: obj.store(key, src, accum, overwrite) without return types