class_docstr: Implementation of the attri2vec algorithm of Zhang et al. with Keras layers.
  see: https://arxiv.org/abs/1901.04095.
  
  The model minimally requires specification of the layer sizes as a list of int
  corresponding to the feature dimensions for each hidden layer and a generator object.
  
  .. seealso::
  
     Examples using Attri2Vec:
  
     - `node classification <https://stellargraph.readthedocs.io/en/stable/demos/node-classification/attri2vec-node-classification.html>`__
     - `link prediction <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/attri2vec-link-prediction.html>`__
     - `unsupervised representation learning <https://stellargraph.readthedocs.io/en/stable/demos/embeddings/attri2vec-embeddings.html>`__
     - `comparison of link prediction algorithms <https://stellargraph.readthedocs.io/en/stable/demos/link-prediction/homogeneous-comparison-link-prediction.html>`__
  
     Appropriate data generators: :class:`.Attri2VecNodeGenerator`, :class:`.Attri2VecLinkGenerator`.
  
  Args:
      layer_sizes (list): Hidden feature dimensions for each layer.
      generator (Sequence): A NodeSequence or LinkSequence.
      bias (bool): If True a bias vector is learnt for each layer in the attri2vec model, default to False.
      activation (str): The activation function of each layer in the attri2vec model, which takes values from ``linear``, ``relu`` and ``sigmoid`` (default).
      normalize ("l2" or None): The normalization used after each layer, default to None.
      input_dim (int, optional): The dimensions of the node features used as input to the model.
      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).
  
  .. note::
      The values for ``input_dim``, ``node_num``, and ``multiplicity`` are obtained from the
      provided ``generator`` by default. The additional keyword arguments for these parameters
      provide an alternative way to specify them if a generator cannot be supplied.
class_docstr_tok: ["Implementation","of","the","attri2vec","algorithm","of","Zhang","et","al",".","with","Keras","layers",".","see",":","https",":","\/\/arxiv.org\/abs\/1901.04095",".","The","model","minimally","requires","specification","of","the","layer","sizes","as","a","list","of","int","corresponding","to","the","feature","dimensions","for","each","hidden","layer","and","a","generator","object",".","..","seealso",":",":","Examples","using","Attri2Vec",":","-","`","node","classification","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/node-classification\/attri2vec-node-classification.html",">","`","__","-","`","link","prediction","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/link-prediction\/attri2vec-link-prediction.html",">","`","__","-","`","unsupervised","representation","learning","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/embeddings\/attri2vec-embeddings.html",">","`","__","-","`","comparison","of","link","prediction","algorithms","<","https",":","\/\/stellargraph.readthedocs.io\/en\/stable\/demos\/link-prediction\/homogeneous-comparison-link-prediction.html",">","`","__","Appropriate","data","generators",":",":","class",":","`",".Attri2VecNodeGenerator","`",",",":","class",":","`",".Attri2VecLinkGenerator","`",".","Args",":","layer_sizes","(","list",")",":","Hidden","feature","dimensions","for","each","layer",".","generator","(","Sequence",")",":","A","NodeSequence","or","LinkSequence",".","bias","(","bool",")",":","If","True","a","bias","vector","is","learnt","for","each","layer","in","the","attri2vec","model",",","default","to","False",".","activation","(","str",")",":","The","activation","function","of","each","layer","in","the","attri2vec","model",",","which","takes","values","from","``","linear","``",",","``","relu","``","and","``","sigmoid","``","(","default",")",".","normalize","(","``","l2","''","or","None",")",":","The","normalization","used","after","each","layer",",","default","to","None",".","input_dim","(","int",",","optional",")",":","The","dimensions","of","the","node","features","used","as","input","to","the","model",".","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",")",".","..","note",":",":","The","values","for","``","input_dim","``",",","``","node_num","``",",","and","``","multiplicity","``","are","obtained","from","the","provided","``","generator","``","by","default",".","The","additional","keyword","arguments","for","these","parameters","provide","an","alternative","way","to","specify","them","if","a","generator","can","not","be","supplied","."]
docstr: Builds a Attri2Vec model for context node prediction.
  
  Returns:
      tuple: (x_inp, x_out) where ``x_inp`` is a list of Keras input tensors for (src, dst) nodes in the node pairs
      and ``x_out`` is a list of output tensors for (src, dst) nodes in the node pairs
docstr_tok: ["Builds","a","Attri2Vec","model","for","context","node","prediction",".","Returns",":","tuple",":","(","x_inp",",","x_out",")","where","``","x_inp","``","is","a","list","of","Keras","input","tensors","for","(","src",",","dst",")","nodes","in","the","node","pairs","and","``","x_out","``","is","a","list","of","output","tensors","for","(","src",",","dst",")","nodes","in","the","node","pairs"]
code: def _link_model(self):
      """
      Builds a Attri2Vec model for context node prediction.
  
      Returns:
          tuple: (x_inp, x_out) where ``x_inp`` is a list of Keras input tensors for (src, dst) nodes in the node pairs
          and ``x_out`` is a list of output tensors for (src, dst) nodes in the node pairs
  
      """
      # Expose input and output sockets of the model, for source node:
      x_inp_src, x_out_src = self._node_model()
  
      # Expose input and out sockets of the model, for target node:
      x_inp_dst = Input(shape=(1,))
  
      assert isinstance(self._output_embedding, Embedding)
      x_out_dst = self._output_embedding(x_inp_dst)
      x_out_dst = Reshape((self.dims[self.n_layers],))(x_out_dst)
  
      x_inp = [x_inp_src, x_inp_dst]
      x_out = [x_out_src, x_out_dst]
      return x_inp, x_out
  
file_path: stellargraph/stellargraph/layer/attri2vec.py
imports: from tensorflow.keras import Input
  from tensorflow.keras import backend
  from tensorflow.keras.layers import Dense, Lambda, Reshape, Embedding
  import warnings
  from .misc import deprecated_model_function
  from ..mapper import Attri2VecLinkGenerator, Attri2VecNodeGenerator
label_desc: Use image node_id 5 for calling the Attri2Vec obj's underlying member method code with example usage: obj._link_model() and returns: x_inp,  x_out