class_docstr: The MetaPath2Vec model from the `"metapath2vec: Scalable Representation
  Learning for Heterogeneous Networks"
  <https://ericdongyx.github.io/papers/
  KDD17-dong-chawla-swami-metapath2vec.pdf>`_ paper where random walks based
  on a given :obj:`metapath` are sampled in a heterogeneous graph, and node
  embeddings are learned via negative sampling optimization.
  
  .. note::
  
      For an example of using MetaPath2Vec, see
      `examples/hetero/metapath2vec.py
      <https://github.com/pyg-team/pytorch_geometric/blob/master/examples/
      hetero/metapath2vec.py>`_.
  
  Args:
      edge_index_dict (Dict[Tuple[str, str, str], torch.Tensor]): Dictionary
          holding edge indices for each
          :obj:`(src_node_type, rel_type, dst_node_type)` edge type present
          in the heterogeneous graph.
      embedding_dim (int): The size of each embedding vector.
      metapath (List[Tuple[str, str, str]]): The metapath described as a list
          of :obj:`(src_node_type, rel_type, dst_node_type)` tuples.
      walk_length (int): The walk length.
      context_size (int): The actual context size which is considered for
          positive samples. This parameter increases the effective sampling
          rate by reusing samples across different source nodes.
      walks_per_node (int, optional): The number of walks to sample for each
          node. (default: :obj:`1`)
      num_negative_samples (int, optional): The number of negative samples to
          use for each positive sample. (default: :obj:`1`)
      num_nodes_dict (Dict[str, int], optional): Dictionary holding the
          number of nodes for each node type. (default: :obj:`None`)
      sparse (bool, optional): If set to :obj:`True`, gradients w.r.t. to the
          weight matrix will be sparse. (default: :obj:`False`)
class_docstr_tok: ["The","MetaPath2Vec","model","from","the","`","``","metapath2vec",":","Scalable","Representation","Learning","for","Heterogeneous","Networks","''","<","https",":","\/\/ericdongyx.github.io\/papers\/","KDD17-dong-chawla-swami-metapath2vec.pdf",">","`","_","paper","where","random","walks","based","on","a","given",":","obj",":","`","metapath","`","are","sampled","in","a","heterogeneous","graph",",","and","node","embeddings","are","learned","via","negative","sampling","optimization",".","..","note",":",":","For","an","example","of","using","MetaPath2Vec",",","see","`","examples\/hetero\/metapath2vec.py","<","https",":","\/\/github.com\/pyg-team\/pytorch_geometric\/blob\/master\/examples\/","hetero\/metapath2vec.py",">","`","_",".","Args",":","edge_index_dict","(","Dict","[","Tuple","[","str",",","str",",","str","]",",","torch.Tensor","]",")",":","Dictionary","holding","edge","indices","for","each",":","obj",":","`","(","src_node_type",",","rel_type",",","dst_node_type",")","`","edge","type","present","in","the","heterogeneous","graph",".","embedding_dim","(","int",")",":","The","size","of","each","embedding","vector",".","metapath","(","List","[","Tuple","[","str",",","str",",","str","]","]",")",":","The","metapath","described","as","a","list","of",":","obj",":","`","(","src_node_type",",","rel_type",",","dst_node_type",")","`","tuples",".","walk_length","(","int",")",":","The","walk","length",".","context_size","(","int",")",":","The","actual","context","size","which","is","considered","for","positive","samples",".","This","parameter","increases","the","effective","sampling","rate","by","reusing","samples","across","different","source","nodes",".","walks_per_node","(","int",",","optional",")",":","The","number","of","walks","to","sample","for","each","node",".","(","default",":",":","obj",":","`","1","`",")","num_negative_samples","(","int",",","optional",")",":","The","number","of","negative","samples","to","use","for","each","positive","sample",".","(","default",":",":","obj",":","`","1","`",")","num_nodes_dict","(","Dict","[","str",",","int","]",",","optional",")",":","Dictionary","holding","the","number","of","nodes","for","each","node","type",".","(","default",":",":","obj",":","`","None","`",")","sparse","(","bool",",","optional",")",":","If","set","to",":","obj",":","`","True","`",",","gradients","w.r.t",".","to","the","weight","matrix","will","be","sparse",".","(","default",":",":","obj",":","`","False","`",")"]
docstr: Returns the data loader that creates both positive and negative
  random walks on the heterogeneous graph.
  
  Args:
      **kwargs (optional): Arguments of
          :class:`torch.utils.data.DataLoader`, such as
          :obj:`batch_size`, :obj:`shuffle`, :obj:`drop_last` or
          :obj:`num_workers`.
docstr_tok: ["Returns","the","data","loader","that","creates","both","positive","and","negative","random","walks","on","the","heterogeneous","graph",".","Args",":","*","*","kwargs","(","optional",")",":","Arguments","of",":","class",":","`","torch.utils.data.DataLoader","`",",","such","as",":","obj",":","`","batch_size","`",",",":","obj",":","`","shuffle","`",",",":","obj",":","`","drop_last","`","or",":","obj",":","`","num_workers","`","."]
code: def loader(self, **kwargs):
      r"""Returns the data loader that creates both positive and negative
      random walks on the heterogeneous graph.
  
      Args:
          **kwargs (optional): Arguments of
              :class:`torch.utils.data.DataLoader`, such as
              :obj:`batch_size`, :obj:`shuffle`, :obj:`drop_last` or
              :obj:`num_workers`.
      """
      return DataLoader(
          range(self.num_nodes_dict[self.metapath[0][0]]),
          collate_fn=self._sample,
          **kwargs,
      )
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  from torch import Tensor
  from torch.nn import Embedding
  from torch.utils.data import DataLoader
  from torch_geometric.typing import EdgeType, NodeType, OptTensor
  from torch_geometric.utils import sort_edge_index
  from torch_geometric.utils.sparse import index2ptr
label_desc: Use image node_id 4 for calling the MetaPath2Vec obj's underlying member method code with example usage: obj.loader() and returns: DataLoader