class_docstr: Tests of GAT class
class_docstr_tok: ["Tests","of","GAT","class"]
code: def test_constructor(self):
      G = example_graph(feature_size=self.F_in)
      gen = FullBatchNodeGenerator(
          G, sparse=self.sparse, method=self.method
      )
      # test default if no activations are passed:
      gat = GAT(layer_sizes=self.layer_sizes, generator=gen, bias=True)
      assert gat.activations == ["elu", "elu"]
  
      # test error if too many activations:
      with pytest.raises(ValueError):
          gat = GAT(
              layer_sizes=[10],
              activations=self.activations,
              generator=gen,
          )
  
      # test error if too few activations:
      with pytest.raises(ValueError):
          gat = GAT(
              layer_sizes=[10, 10], activations=["relu"], generator=gen
          )
  
      # test error where layer_sizes is not a list:
      with pytest.raises(TypeError):
          gat = GAT(
              layer_sizes=10,
              activations=self.activations,
              attn_heads=self.attn_heads,
              generator=gen,
              bias=True,
          )
  
      # test error where layer_sizes values are not valid
      with pytest.raises(ValueError):
          gat = GAT(
              layer_sizes=[4, 0],
              activations=self.activations,
              attn_heads=self.attn_heads,
              generator=gen,
              bias=True,
          )
  
      # test for incorrect length of att_heads list:
      with pytest.raises(ValueError):
          gat = GAT(
              layer_sizes=self.layer_sizes,
              activations=self.activations,
              attn_heads=[8, 8, 1],
              generator=gen,
              bias=True,
          )
  
      # test for invalid values in att_heads list:
      with pytest.raises(ValueError):
          gat = GAT(
              layer_sizes=self.layer_sizes,
              activations=self.activations,
              attn_heads=[8, 0],
              generator=gen,
              bias=True,
          )
  
      # test for invalid type of att_heads argument:
      with pytest.raises(TypeError):
          gat = GAT(
              layer_sizes=self.layer_sizes,
              activations=self.activations,
              attn_heads=8.0,
              generator=gen,
              bias=True,
          )
  
      # test error where activations is not a list:
      with pytest.raises(TypeError):
          gat = GAT(
              layer_sizes=self.layer_sizes,
              activations="relu",
              generator=gen,
              bias=True,
          )
  
      # test attn_heads_reduction errors:
      with pytest.raises(TypeError):
          gat = GAT(
              layer_sizes=self.layer_sizes,
              activations=self.activations,
              attn_heads=self.attn_heads,
              attn_heads_reduction="concat",
              generator=gen,
              bias=True,
          )
      with pytest.raises(ValueError):
          gat = GAT(
              layer_sizes=self.layer_sizes,
              activations=self.activations,
              attn_heads=self.attn_heads,
              attn_heads_reduction=["concat", "concat", "average"],
              generator=gen,
              bias=True,
          )
      with pytest.raises(ValueError):
          gat = GAT(
              layer_sizes=self.layer_sizes,
              activations=self.activations,
              attn_heads=self.attn_heads,
              attn_heads_reduction=["concat", "sum"],
              generator=gen,
              bias=True,
          )
  
      # test error where len(activations) is not equal to len(layer_sizes):
      with pytest.raises(ValueError):
          gat = GAT(
              layer_sizes=self.layer_sizes,
              activations=["relu"],
              generator=gen,
              bias=True,
          )
  
      # Default attention heads reductions:
      gat = GAT(
          layer_sizes=self.layer_sizes,
          activations=self.activations,
          attn_heads=self.attn_heads,
          generator=gen,
          bias=True,
      )
  
      assert gat.activations == self.activations
      assert gat.attn_heads_reduction == ["concat", "average"]
      assert gat.generator == gen
  
      # User-specified attention heads reductions:
      gat = GAT(
          layer_sizes=self.layer_sizes,
          activations=self.activations,
          attn_heads=self.attn_heads,
          attn_heads_reduction=["concat", "concat"],
          generator=gen,
          bias=True,
      )
  
      assert gat.attn_heads_reduction == ["concat", "concat"]
  
imports: import pytest
  import scipy.sparse
  import tensorflow
  from tensorflow import keras
  from tensorflow.keras import backend
  from tensorflow.keras.layers import Input
  from stellargraph.mapper import FullBatchNodeGenerator, FullBatchLinkGenerator, GraphSAGENodeGenerator
  from stellargraph.layer import *
  from ..test_utils.graphs import example_graph
  from ..None import test_utils
label_desc: Use image node_id 1 for calling the Test_GAT obj's underlying member method code with example usage: obj.test_constructor() without return types