class_docstr: Implementation of the Node2Vec algorithm of A. Grover and J. Leskovec with Keras layers.
  see: https://snap.stanford.edu/node2vec/
  
  The model minimally requires specification of the embedding size and a generator object.
  
  .. seealso::
  
     Examples using Node2Vec:
  
     - `node classification <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/keras-node2vec-node-classification.html>`__
     - `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/keras-node2vec-embeddings.html>`__
     - `comparison of link prediction algorithms <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/homogeneous-comparison-link-prediction.html>`__
     - using Gensim Word2Vec, not this class: `node classification <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/node2vec-node-classification.html>`__, `node classification with edge weights <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/node2vec-weighted-node-classification.html>`__, `link prediction <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/node2vec-link-prediction.html>`__, `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/node2vec-embeddings.html>`__.
  
     Appropriate data generators: :class:`.Node2VecNodeGenerator`, :class:`.Node2VecLinkGenerator`.
  
     Related functionality: :class:`.BiasedRandomWalk` does the underlying random walks.
  
  Args:
      emb_size (int): The dimension of node embeddings.
      generator (Sequence): A NodeSequence or LinkSequence.
      node_num(int, optional): The number of nodes in the given graph.
      multiplicity (int, optional): The number of nodes to process at a time. This is 1 for a node inference
        and 2 for link inference (currently no others are supported).
docstr: Builds a Node2Vec model for node or link/node pair prediction, depending on the generator used to construct
  the model (whether it is a node or link/node pair generator).
  
  Returns:
      tuple: ``(x_inp, x_out)``, where ``x_inp`` contains Keras input tensor(s)
          for the specified Node2Vec model (either node or link/node pair model) and ``x_out`` contains
          model output tensor(s) of shape (batch_size, self.emb_size)
docstr_tok: ["Builds","a","Node2Vec","model","for","node","or","link\/node","pair","prediction",",","depending","on","the","generator","used","to","construct","the","model","(","whether","it","is","a","node","or","link\/node","pair","generator",")",".","Returns",":","tuple",":","``","(","x_inp",",","x_out",")","``",",","where","``","x_inp","``","contains","Keras","input","tensor","(","s",")","for","the","specified","Node2Vec","model","(","either","node","or","link\/node","pair","model",")","and","``","x_out","``","contains","model","output","tensor","(","s",")","of","shape","(","batch_size",",","self.emb_size",")"]
code: def in_out_tensors(self, multiplicity=None):
      """
      Builds a Node2Vec model for node or link/node pair prediction, depending on the generator used to construct
      the model (whether it is a node or link/node pair generator).
  
      Returns:
          tuple: ``(x_inp, x_out)``, where ``x_inp`` contains Keras input tensor(s)
              for the specified Node2Vec model (either node or link/node pair model) and ``x_out`` contains
              model output tensor(s) of shape (batch_size, self.emb_size)
  
      """
      if multiplicity is None:
          multiplicity = self.multiplicity
      if self.multiplicity == 1:
          return self._node_model()
      elif self.multiplicity == 2:
          return self._link_model()
      else:
          raise ValueError(
              "Currently only multiplicities of 1 and 2 are supported."
          )
  
file_path: stellargraph/stellargraph/layer/node2vec.py
imports: from tensorflow.keras import Input
  from tensorflow.keras.layers import Reshape, Embedding
  import math
  from tensorflow import keras
  import warnings
  from .misc import deprecated_model_function
  from ..mapper import Node2VecLinkGenerator, Node2VecNodeGenerator
label_desc: Use image node_id 6 for calling the Node2Vec obj's underlying member method code with example usage: obj.in_out_tensors(multiplicity) and returns: self, self