class_docstr: Group of tests for link_inference() function
docstr: Test the binary operators: 'mul'/'Hadamard', 'l1', 'l2', 'avg'
docstr_tok: ["Test","the","binary","operators",":","'mul'\/'Hadamard","'",",","'l1","'",",","'l2","'",",","'avg","'"]
code: def test_mul_l1_l2_avg_single_tensor(self):
      """Test the binary operators: 'mul'/'Hadamard', 'l1', 'l2', 'avg'"""
  
      x_src, x_dst = make_orthonormal_vectors(self.d)
      x_src = x_src.reshape(1, self.d)
      x_dst = x_dst.reshape(1, self.d)
      x_link_np = np.stack([x_src, x_dst], axis=1)
      x_link = keras.Input(shape=(2, self.d))
  
      for op in ["mul", "l1", "l2", "avg"]:
          out = LinkEmbedding(method=op)(x_link)
          li = keras.Model(inputs=x_link, outputs=out)
  
          res = li.predict(x=x_link_np)
          print(
              "link inference with '{}' operator: {}".format(
                  op, res.flatten()
              )
          )
          assert res.shape == (1, self.d)
          assert isinstance(res.flatten()[0], np.float32)
  
      for op in ["concat"]:
          out = LinkEmbedding(method=op)(x_link)
          li = keras.Model(inputs=x_link, outputs=out)
          res = li.predict(x=x_link_np)
          print(
              "link inference with '{}' operator: {}".format(
                  op, res.flatten()
              )
          )
          assert res.shape == (1, 2 * self.d)
          assert isinstance(res.flatten()[0], np.float32)
  
imports: from stellargraph.layer.link_inference import *
  import tensorflow
  from tensorflow import keras
  import numpy
  import pytest
label_desc: Use image node_id 4 for calling the Test_LinkEmbedding obj's underlying member method code with example usage: obj.test_mul_l1_l2_avg_single_tensor() without return types