code: def test_predict():
      tf.keras.backend.clear_session()
  
      # test_data = np.array([[0, 0], [1, 1], [0.8, 0.8]])
      test_data = np.array([4, 5, 6])
      test_targets = np.array([[1, 0], [0, 1], [0, 1]])
  
      graph = example_graph_1(feature_size=2)
  
      # base_model, keras_model, generator, train_gen
      gnn_models = [
          create_graphSAGE_model(graph),
          create_HinSAGE_model(graph),
          create_GCN_model(graph),
          create_GAT_model(graph),
      ]
  
      for i, gnn_model in enumerate(gnn_models):
          keras_model = gnn_model[1]
          generator = gnn_model[2]
  
          ens = Ensemble(keras_model, n_estimators=2, n_predictions=2)
  
          ens.compile(
              optimizer=Adam(),
              loss=categorical_crossentropy,
              weighted_metrics=["acc"],
          )
  
          test_gen = generator.flow(test_data)
          # Check that passing invalid parameters is handled correctly. We will not check error handling for those
          # parameters that Keras will be responsible for.
          with pytest.raises(ValueError):
              ens.predict(generator=test_gen, predict_data=test_data)
  
          # We won't train the model instead use the initial random weights to test
          # the evaluate method.
          test_predictions = ens.predict(test_gen, summarise=True)
  
          print(
              "test_predictions shape {}".format(test_predictions.shape)
          )
          if i > 1:
              # GAT and GCN are full batch so the batch dimension is 1
              assert len(test_predictions) == 1
              assert test_predictions.shape[1] == test_targets.shape[0]
          else:
              assert len(test_predictions) == len(test_data)
          assert test_predictions.shape[-1] == test_targets.shape[-1]
  
          test_predictions = ens.predict(test_gen, summarise=False)
  
          assert test_predictions.shape[0] == ens.n_estimators
          assert test_predictions.shape[1] == ens.n_predictions
          if i > 1:
              assert test_predictions.shape[2] == 1
          else:
              assert test_predictions.shape[2] == len(test_data)
          assert test_predictions.shape[-1] == test_targets.shape[-1]
  
          #
          # Repeat for BaggingEnsemble
          ens = BaggingEnsemble(
              keras_model, n_estimators=2, n_predictions=2
          )
  
          ens.compile(
              optimizer=Adam(),
              loss=categorical_crossentropy,
              weighted_metrics=["acc"],
          )
  
          test_gen = generator.flow(test_data)
          # Check that passing invalid parameters is handled correctly. We will not check error handling for those
          # parameters that Keras will be responsible for.
          with pytest.raises(ValueError):
              ens.predict(generator=test_gen, predict_data=test_data)
  
          # We won't train the model instead use the initial random weights to test
          # the evaluate method.
          test_predictions = ens.predict(test_gen, summarise=True)
  
          print(
              "test_predictions shape {}".format(test_predictions.shape)
          )
          if i > 1:
              # GAT and GCN are full batch so the batch dimension is 1
              assert len(test_predictions) == 1
              assert test_predictions.shape[1] == test_targets.shape[0]
          else:
              assert len(test_predictions) == len(test_data)
          assert test_predictions.shape[-1] == test_targets.shape[-1]
  
          test_predictions = ens.predict(test_gen, summarise=False)
  
          assert test_predictions.shape[0] == ens.n_estimators
          assert test_predictions.shape[1] == ens.n_predictions
          if i > 1:
              assert test_predictions.shape[2] == 1
          else:
              assert test_predictions.shape[2] == len(test_data)
          assert test_predictions.shape[-1] == test_targets.shape[-1]
  
imports: import pandas
  import pytest
  import numpy
  import tensorflow
  from stellargraph import StellarGraph
  from stellargraph.layer import GraphSAGE, GCN, GAT, HinSAGE, link_classification, link_regression
  from stellargraph.mapper import GraphSAGENodeGenerator, FullBatchNodeGenerator, HinSAGENodeGenerator, GraphSAGELinkGenerator, HinSAGELinkGenerator
  from stellargraph.ensemble import Ensemble, BaggingEnsemble
  from tensorflow.keras import layers, Model
  from tensorflow.keras.optimizers import Adam
  from tensorflow.keras.losses import categorical_crossentropy, binary_crossentropy
label_desc: Use image node_id 11 for calling a global function with example usage: test_predict() without return types