code: def test_stateful():
      layer_sizes = [16, 2]
      activations = ["elu", "elu"]
      targets = np.array([[0, 1], [0, 1], [1, 0]])
      train_graphs = [0, 1, 2]
  
      gcn_graph_model = GCNSupervisedGraphClassification(
          generator=generator,
          activations=activations,
          layer_sizes=layer_sizes,
      )
  
      train_gen = generator.flow(graphs=train_graphs, targets=targets)
  
      model_1 = tf.keras.Model(*gcn_graph_model.in_out_tensors())
      model_2 = tf.keras.Model(*gcn_graph_model.in_out_tensors())
  
      # check embeddings are equal before training
      embeddings_1 = model_1.predict(train_gen)
      embeddings_2 = model_2.predict(train_gen)
  
      np.testing.assert_array_equal(embeddings_1, embeddings_2)
  
      model_1.compile(
          loss=tf.nn.softmax_cross_entropy_with_logits, optimizer="Adam"
      )
      model_1.fit(train_gen)
  
      # check embeddings are still equal after training one model
      embeddings_1 = model_1.predict(train_gen)
      embeddings_2 = model_2.predict(train_gen)
  
      np.testing.assert_array_equal(embeddings_1, embeddings_2)
  
      model_2.compile(
          loss=tf.nn.softmax_cross_entropy_with_logits, optimizer="Adam"
      )
      model_2.fit(train_gen)
  
      # check embeddings are still equal after training both models
      embeddings_1 = model_1.predict(train_gen)
      embeddings_2 = model_2.predict(train_gen)
  
      np.testing.assert_array_equal(embeddings_1, embeddings_2)
  
file_path: stellargraph/tests/layer/test_graph_classification.py
imports: import numpy
  import tensorflow
  from stellargraph.layer.graph_classification import *
  from stellargraph.layer import SortPooling
  from stellargraph.mapper import PaddedGraphGenerator, FullBatchNodeGenerator
  import pytest
  from ..test_utils.graphs import example_graph_random
  from ..None import test_utils
label_desc: Use image node_id 3 for calling a global function with example usage: test_stateful() without return types