code: def test_embedding_validation(knowledge_graph):
      class X(layers.Layer, KGScore):
          def __init__(self, emb):
              self.emb = emb
  
          def embeddings(self, *args, **kwargs):
              return self.emb
  
          def bulk_scoring(self, *args, **kwargs):
              raise NotImplementedError()
  
      gen = KGTripleGenerator(knowledge_graph, 3)
  
      e = layers.Embedding(5, 4)
  
      kwargs = {
          "embeddings_initializer": None,
          "embeddings_regularizer": None,
      }
      with pytest.raises(
          ValueError, match="scoring: .* found a sequence of length 3"
      ):
          KGModel(gen, X((1, 2, 3)), 2, **kwargs)
  
      with pytest.raises(
          ValueError,
          match=r"scoring: .* found a pair with types \(Embedding, int\)",
      ):
          KGModel(gen, X((e, 2)), 2, **kwargs)
  
      with pytest.raises(
          ValueError,
          match=r"scoring: .* found a pair of lists containing types \(\[Embedding, Embedding\], \[int\]\)",
      ):
          KGModel(gen, X(([e, e], [2])), 2, **kwargs)
  
      # all good:
      KGModel(gen, X(([e, e], [e, e, e])), 2, **kwargs)
  
file_path: stellargraph/tests/layer/test_knowledge_graph.py
imports: import itertools
  import pytest
  import pandas
  import numpy
  import tensorflow
  from tensorflow.keras import Model, initializers, losses, layers
  from stellargraph import StellarGraph, StellarDiGraph, losses
  from stellargraph.mapper.knowledge_graph import KGTripleGenerator
  from stellargraph.layer.knowledge_graph import KGModel, KGScore, ComplEx, DistMult, RotatE, RotE, RotH, _ranks_from_score_columns
  from ..None import test_utils
  from ..test_utils.graphs import knowledge_graph
label_desc: Use image node_id 8 for calling a global function with example usage: test_embedding_validation(knowledge_graph) and returns: self