class_docstr: PinSage-like neighbor sampler extended to any heterogeneous graphs.
  
  Given a heterogeneous graph and a list of nodes, this callable will generate a homogeneous
  graph where the neighbors of each given node are the most commonly visited nodes of the
  same type by multiple random walks starting from that given node.  Each random walk consists
  of multiple metapath-based traversals, with a probability of termination after each traversal.
  
  The edges of the returned homogeneous graph will connect to the given nodes from their most
  commonly visited nodes, with a feature indicating the number of visits.
  
  The metapath must have the same beginning and ending node type to make the algorithm work.
  
  This is a generalization of PinSAGE sampler which only works on bidirectional bipartite
  graphs.
  
  UVA and GPU sampling is supported for this sampler.
  Refer to :ref:`guide-minibatch-gpu-sampling` for more details.
  
  Parameters
  ----------
  G : DGLGraph
      The graph.
  num_traversals : int
      The maximum number of metapath-based traversals for a single random walk.
  
      Usually considered a hyperparameter.
  termination_prob : float
      Termination probability after each metapath-based traversal.
  
      Usually considered a hyperparameter.
  num_random_walks : int
      Number of random walks to try for each given node.
  
      Usually considered a hyperparameter.
  num_neighbors : int
      Number of neighbors (or most commonly visited nodes) to select for each given node.
  metapath : list[str] or list[tuple[str, str, str]], optional
      The metapath.
  
      If not given, DGL assumes that the graph is homogeneous and the metapath consists
      of one step over the single edge type.
  weight_column : str, default "weights"
      The name of the edge feature to be stored on the returned graph with the number of
      visits.
  
  Examples
  --------
  See examples in :any:`PinSAGESampler`.
docstr: Parameters
  ----------
  seed_nodes : Tensor
      A tensor of given node IDs of node type ``ntype`` to generate neighbors from.  The
      node type ``ntype`` is the beginning and ending node type of the given metapath.
  
      It must be on the same device as the graph and have the same dtype
      as the ID type of the graph.
  
  Returns
  -------
  g : DGLGraph
      A homogeneous graph constructed by selecting neighbors for each given node according
      to the algorithm above.
code: def __call__(self, seed_nodes):
      """
      Parameters
      ----------
      seed_nodes : Tensor
          A tensor of given node IDs of node type ``ntype`` to generate neighbors from.  The
          node type ``ntype`` is the beginning and ending node type of the given metapath.
  
          It must be on the same device as the graph and have the same dtype
          as the ID type of the graph.
  
      Returns
      -------
      g : DGLGraph
          A homogeneous graph constructed by selecting neighbors for each given node according
          to the algorithm above.
      """
      seed_nodes = utils.prepare_tensor(
          self.G, seed_nodes, "seed_nodes"
      )
      self.restart_prob = F.copy_to(
          self.restart_prob, F.context(seed_nodes)
      )
  
      seed_nodes = F.repeat(seed_nodes, self.num_random_walks, 0)
      paths, _ = random_walk(
          self.G,
          seed_nodes,
          metapath=self.full_metapath,
          restart_prob=self.restart_prob,
      )
      src = F.reshape(
          paths[:, self.metapath_hops :: self.metapath_hops], (-1,)
      )
      dst = F.repeat(paths[:, 0], self.num_traversals, 0)
  
      src, dst, counts = _select_pinsage_neighbors(
          src,
          dst,
          (self.num_random_walks * self.num_traversals),
          self.num_neighbors,
      )
      neighbor_graph = convert.heterograph(
          {(self.ntype, "_E", self.ntype): (src, dst)},
          {self.ntype: self.G.num_nodes(self.ntype)},
      )
      neighbor_graph.edata[self.weight_column] = counts
  
      return neighbor_graph
  
file_path: dgl/python/dgl/sampling/pinsage.py
imports: import numpy
  from ..None import backend, convert, utils
  from .._ffi.function import _init_api
  from .randomwalks import random_walk
label_desc: Use image node_id 2 for calling the RandomWalkNeighborSampler obj's underlying member method code with example usage: obj.__call__(seed_nodes) and returns: neighbor_graph