code: def check_sequence_output(
      output,
      batch_size,
      negatives,
      max_node_iloc=None,
      source_ilocs=None,
      rel_ilocs=None,
      target_ilocs=None,
      sample_strategy="uniform",
  ):
      s, r, o = output[0]
      l = output[1] if len(output) == 2 else None
  
      expected_length = batch_size * (1 + (negatives or 0))
      assert len(s) == len(r) == len(o) == expected_length
  
      if source_ilocs is not None:
          expected_pos = set(zip(source_ilocs, rel_ilocs, target_ilocs))
          actual_pos = set(
              zip(s[:batch_size], r[:batch_size], o[:batch_size])
          )
          # the positive edges should all be edges passed in originally
          assert actual_pos <= expected_pos
  
      if negatives is None:
          assert l is None
      else:
          assert len(l) == expected_length
          assert set(l[:batch_size]) == {1}
  
          negative_labels = l[batch_size:]
          if sample_strategy == "uniform":
              assert set(negative_labels) == {0}
          if sample_strategy == "self-adversarial":
              for i in range(batch_size):
                  # every batch_size'th element corresponds to the i'th positive example
                  assert set(negative_labels[i::batch_size]) == {-i}
  
          if max_node_iloc is not None:
              assert np.all((0 <= s) & (s <= max_node_iloc))
              assert np.all((0 <= r) & (r <= max_node_iloc))
  
file_path: stellargraph/tests/mapper/test_knowledge_graph.py
imports: import pytest
  import pandas
  import numpy
  from stellargraph.mapper.knowledge_graph import KGTripleGenerator, KGTripleSequence
  from ..None import test_utils
  from ..test_utils.graphs import knowledge_graph
label_desc: Use image node_id 1 for calling a global function with example usage: check_sequence_output(output, batch_size, negatives, max_node_iloc, source_ilocs, rel_ilocs, target_ilocs, sample_strategy) without return types