class_docstr: An implementation of a distributed and asynchronised neighbor sampler
  used by :class:`~torch_geometric.distributed.DistNeighborLoader`.
class_docstr_tok: ["An","implementation","of","a","distributed","and","asynchronised","neighbor","sampler","used","by",":","class",":","`","~torch_geometric.distributed.DistNeighborLoader","`","."]
docstr: Used when seed nodes belongs to one partition. It's purpose is to
  remove seed nodes from sampled nodes and calculates how many neighbors
  were sampled by each src node based on the
  :obj:`cumsum_neighbors_per_node`. Returns updated sampler output.
docstr_tok: ["Used","when","seed","nodes","belongs","to","one","partition",".","It","'s","purpose","is","to","remove","seed","nodes","from","sampled","nodes","and","calculates","how","many","neighbors","were","sampled","by","each","src","node","based","on","the",":","obj",":","`","cumsum_neighbors_per_node","`",".","Returns","updated","sampler","output","."]
code: def get_sampler_output(
      self,
      outputs: List[SamplerOutput],
      seed_size: int,
      p_id: int,
      src_batch: Optional[Tensor] = None,
  ) -> SamplerOutput:
      r"""Used when seed nodes belongs to one partition. It's purpose is to
      remove seed nodes from sampled nodes and calculates how many neighbors
      were sampled by each src node based on the
      :obj:`cumsum_neighbors_per_node`. Returns updated sampler output.
      """
      cumsum_neighbors_per_node = outputs[p_id].metadata[0]
  
      # do not include seed
      outputs[p_id].node = outputs[p_id].node[seed_size:]
  
      begin = np.array(cumsum_neighbors_per_node[1:])
      end = np.array(cumsum_neighbors_per_node[:-1])
  
      sampled_nbrs_per_node = list(np.subtract(begin, end))
  
      outputs[p_id].metadata = (sampled_nbrs_per_node,)
  
      if self.disjoint:
          batch = [
              [src_batch[i]] * nbrs_per_node
              for i, nbrs_per_node in enumerate(sampled_nbrs_per_node)
          ]
          outputs[p_id].batch = Tensor(
              list(itertools.chain.from_iterable(batch))
          ).type(torch.int64)
  
      return outputs[p_id]
  
imports: import itertools
  import logging
  import math
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.multiprocessing
  from torch import Tensor
  from torch_geometric.distributed import LocalFeatureStore, LocalGraphStore
  from torch_geometric.distributed.dist_context import DistContext
  from torch_geometric.distributed.event_loop import ConcurrentEventLoop, to_asyncio_future
  from torch_geometric.distributed.rpc import RPCCallBase, RPCRouter, rpc_async, rpc_partition_to_workers, rpc_register
  from torch_geometric.distributed.utils import BatchDict, NodeDict, remove_duplicates
  from torch_geometric.sampler import EdgeSamplerInput, HeteroSamplerOutput, NegativeSampling, NeighborSampler, NodeSamplerInput, SamplerOutput
  from torch_geometric.sampler.base import NumNeighbors, SubgraphType
  from torch_geometric.sampler.neighbor_sampler import neg_sample
  from torch_geometric.sampler.utils import remap_keys
  from torch_geometric.typing import EdgeType, NodeType
label_desc: Use image node_id 7 for calling the DistNeighborSampler obj's underlying member method code with example usage: obj.get_sampler_output(outputs, seed_size, p_id, src_batch) and returns: outputs