code: def test_node2vec_apply():
      node2vec = Node2Vec(emb_size=4, node_num=4, multiplicity=2)
  
      x = np.array([[1]])
      expected = np.array([[1, 1, 1, 1]])
  
      inp = keras.Input(shape=(1,))
      out = node2vec(inp, "target")
      model1 = keras.Model(inputs=inp, outputs=out)
      model_weights1 = [np.ones_like(w) for w in model1.get_weights()]
      model1.set_weights(model_weights1)
      actual = model1.predict(x)
      assert expected == pytest.approx(actual)
  
      x1 = np.array([[0]])
      x2 = np.array([[2]])
      y1 = np.array([[1, 1, 1, 1]])
      y2 = np.array([[1, 1, 1, 1]])
  
      # Test the in_out_tensors function:
      xinp, xout = node2vec.in_out_tensors()
      model2 = keras.Model(inputs=xinp, outputs=xout)
      model_weights2 = [np.ones_like(w) for w in model2.get_weights()]
      model2.set_weights(model_weights2)
      actual = model2.predict([x1, x2])
      assert pytest.approx(y1) == actual[0]
      assert pytest.approx(y2) == actual[1]
  
file_path: stellargraph/tests/layer/test_node2vec.py
imports: from stellargraph.core.graph import StellarGraph
  from stellargraph.mapper import Node2VecNodeGenerator
  from stellargraph.layer.node2vec import *
  from tensorflow import keras
  import numpy
  import pytest
  from ..test_utils.graphs import example_graph
  from ..None import test_utils
label_desc: Use image node_id 2 for calling a global function with example usage: test_node2vec_apply() without return types