code: def test_gat_conv_with_edge_attr():
      x = torch.randn(4, 8)
      edge_index = torch.tensor([[0, 1, 2, 3], [1, 0, 1, 1]])
      edge_weight = torch.randn(edge_index.size(1))
      edge_attr = torch.randn(edge_index.size(1), 4)
  
      conv = GATConv(8, 32, heads=2, edge_dim=1, fill_value=0.5)
      out = conv(x, edge_index, edge_weight)
      assert out.size() == (4, 64)
      if torch_geometric.typing.WITH_TORCH_SPARSE:
          adj1 = SparseTensor.from_edge_index(
              edge_index, edge_weight, (4, 4)
          )
          with pytest.raises(NotImplementedError):
              assert torch.allclose(conv(x, adj1.t()), out)
  
      conv = GATConv(8, 32, heads=2, edge_dim=1, fill_value="mean")
      out = conv(x, edge_index, edge_weight)
      assert out.size() == (4, 64)
      if torch_geometric.typing.WITH_TORCH_SPARSE:
          with pytest.raises(NotImplementedError):
              assert torch.allclose(conv(x, adj1.t()), out)
  
      conv = GATConv(8, 32, heads=2, edge_dim=4, fill_value=0.5)
      out = conv(x, edge_index, edge_attr)
      assert out.size() == (4, 64)
      if torch_geometric.typing.WITH_TORCH_SPARSE:
          adj2 = SparseTensor.from_edge_index(
              edge_index, edge_attr, (4, 4)
          )
          with pytest.raises(NotImplementedError):
              assert torch.allclose(conv(x, adj2.t()), out)
  
      conv = GATConv(8, 32, heads=2, edge_dim=4, fill_value="mean")
      out = conv(x, edge_index, edge_attr)
      assert out.size() == (4, 64)
      if torch_geometric.typing.WITH_TORCH_SPARSE:
          with pytest.raises(NotImplementedError):
              assert torch.allclose(conv(x, adj2.t()), out)
  
file_path: pytorch_geometric/test/nn/conv/test_gat_conv.py
imports: from typing import Optional, Tuple
  import pytest
  import torch
  from torch import Tensor
  import torch_geometric.typing
  from torch_geometric.nn import GATConv
  from torch_geometric.testing import is_full_test, withCUDA
  from torch_geometric.typing import Adj, Size, SparseTensor
  from torch_geometric.utils import to_torch_csc_tensor
label_desc: Use image node_id 2 for calling a global function with example usage: test_gat_conv_with_edge_attr() without return types