code: def test_graphsage_constructor():
      gs = GraphSAGE(
          layer_sizes=[4],
          n_samples=[2],
          input_dim=2,
          normalize="l2",
          multiplicity=1,
      )
      assert gs.dims == [2, 4]
      assert gs.n_samples == [2]
      assert gs.max_hops == 1
      assert gs.bias
      assert len(gs._aggs) == 1
  
      # Check incorrect normalization flag
      with pytest.raises(ValueError):
          GraphSAGE(
              layer_sizes=[4],
              n_samples=[2],
              input_dim=2,
              normalize=lambda x: x,
              multiplicity=1,
          )
  
      with pytest.raises(ValueError):
          GraphSAGE(
              layer_sizes=[4],
              n_samples=[2],
              input_dim=2,
              normalize="unknown",
              multiplicity=1,
          )
  
      # Check requirement for generator or n_samples
      with pytest.raises(ValueError):
          GraphSAGE(layer_sizes=[4])
  
      # Construction from generator
      G = example_graph(feature_size=3)
      gen = GraphSAGENodeGenerator(G, batch_size=2, num_samples=[2, 2])
      gs = GraphSAGE(layer_sizes=[4, 8], generator=gen, bias=True)
  
      # The GraphSAGE should no longer accept a Sequence
      t_gen = gen.flow([1, 2])
      with pytest.raises(TypeError):
          gs = GraphSAGE(layer_sizes=[4, 8], generator=t_gen, bias=True)
  
      assert gs.dims == [3, 4, 8]
      assert gs.n_samples == [2, 2]
      assert gs.max_hops == 2
      assert gs.bias
      assert len(gs._aggs) == 2
  
imports: from tensorflow import keras
  from tensorflow.keras import initializers, regularizers
  import tensorflow
  import numpy
  import pytest
  from stellargraph.mapper import GraphSAGENodeGenerator
  from stellargraph.layer.graphsage import GraphSAGE, MeanAggregator, MaxPoolingAggregator, MeanPoolingAggregator, AttentionalAggregator
  from ..test_utils.graphs import example_graph
  from ..None import test_utils
label_desc: Use image node_id 20 for calling a global function with example usage: test_graphsage_constructor() without return types