class_docstr: The graph attentional operator on heterogeneous graphs, where a separate
  `GATConv` is applied on the homogeneous graph for each edge type. Compared
  with directly wrapping `GATConv`s with `HeteroConv`, `HeteroGATConv` fuses
  all the linear transformation associated with each node type together into 1
  GEMM call, to improve the performance on GPUs.
  
  Parameters
  ----------
  in_channels : int or Dict[str, int])
      Size of each input sample of every node type.
  
  out_channels : int
      Size of each output sample.
  
  node_types : List[str]
      List of Node types.
  
  edge_types : List[Tuple[str, str, str]]
      List of Edge types.
  
  heads : int, optional (default=1)
      Number of multi-head-attentions.
  
  concat : bool, optional (default=True):
      If set to :obj:`False`, the multi-head attentions are averaged instead
      of concatenated.
  
  negative_slope : float, optional (default=0.2)
      LeakyReLU angle of the negative slope.
  
  bias : bool, optional (default=True)
      If set to :obj:`False`, the layer will not learn an additive bias.
  
  aggr : str, optional (default="sum")
      The aggregation scheme to use for grouping node embeddings generated by
      different relations. Choose from "sum", "mean", "min", "max".
class_docstr_tok: ["The","graph","attentional","operator","on","heterogeneous","graphs",",","where","a","separate","`","GATConv","`","is","applied","on","the","homogeneous","graph","for","each","edge","type",".","Compared","with","directly","wrapping","`","GATConv","`","s","with","`","HeteroConv","`",",","`","HeteroGATConv","`","fuses","all","the","linear","transformation","associated","with","each","node","type","together","into","1","GEMM","call",",","to","improve","the","performance","on","GPUs",".","Parameters","--","--","--","--","--","in_channels",":","int","or","Dict","[","str",",","int","]",")","Size","of","each","input","sample","of","every","node","type",".","out_channels",":","int","Size","of","each","output","sample",".","node_types",":","List","[","str","]","List","of","Node","types",".","edge_types",":","List","[","Tuple","[","str",",","str",",","str","]","]","List","of","Edge","types",".","heads",":","int",",","optional","(","default=1",")","Number","of","multi-head-attentions",".","concat",":","bool",",","optional","(","default=True",")",":","If","set","to",":","obj",":","`","False","`",",","the","multi-head","attentions","are","averaged","instead","of","concatenated",".","negative_slope",":","float",",","optional","(","default=0.2",")","LeakyReLU","angle","of","the","negative","slope",".","bias",":","bool",",","optional","(","default=True",")","If","set","to",":","obj",":","`","False","`",",","the","layer","will","not","learn","an","additive","bias",".","aggr",":","str",",","optional","(","default=","''","sum","''",")","The","aggregation","scheme","to","use","for","grouping","node","embeddings","generated","by","different","relations",".","Choose","from","``","sum","''",",","``","mean","''",",","``","min","''",",","``","max","''","."]
code: def __init__(
      self,
      in_channels: Union[int, dict[str, int]],
      out_channels: int,
      node_types: list[str],
      edge_types: list[tuple[str, str, str]],
      heads: int = 1,
      concat: bool = True,
      negative_slope: float = 0.2,
      bias: bool = True,
      aggr: str = "sum",
  ):
      major, minor, patch = torch_geometric.__version__.split(".")[:3]
      pyg_version = tuple(map(int, [major, minor, patch]))
      if pyg_version < (2, 4, 0):
          raise RuntimeError(
              f"{self.__class__.__name__} requires pyg >= 2.4.0."
          )
  
      super().__init__()
  
      if isinstance(in_channels, int):
          in_channels = dict.fromkeys(node_types, in_channels)
      self.in_channels = in_channels
      self.out_channels = out_channels
  
      self.node_types = node_types
      self.edge_types = edge_types
      self.num_heads = heads
      self.concat_heads = concat
  
      self.negative_slope = negative_slope
      self.aggr = aggr
  
      self.relations_per_ntype = defaultdict(lambda: ([], []))
  
      lin_weights = dict.fromkeys(self.node_types)
      attn_weights = dict.fromkeys(self.edge_types)
      biases = dict.fromkeys(self.edge_types)
  
      ParameterDict = torch_geometric.nn.parameter_dict.ParameterDict
  
      for edge_type in self.edge_types:
          src_type, _, dst_type = edge_type
          self.relations_per_ntype[src_type][0].append(edge_type)
          if src_type != dst_type:
              self.relations_per_ntype[dst_type][1].append(edge_type)
  
          attn_weights[edge_type] = torch.empty(
              2 * self.num_heads * self.out_channels
          )
  
          if bias and concat:
              biases[edge_type] = torch.empty(
                  self.num_heads * out_channels
              )
          elif bias:
              biases[edge_type] = torch.empty(out_channels)
          else:
              biases[edge_type] = None
  
      for ntype in self.node_types:
          n_src_rel = len(self.relations_per_ntype[ntype][0])
          n_dst_rel = len(self.relations_per_ntype[ntype][1])
          n_rel = n_src_rel + n_dst_rel
  
          lin_weights[ntype] = torch.empty(
              (
                  n_rel * self.num_heads * self.out_channels,
                  self.in_channels[ntype],
              )
          )
  
      self.lin_weights = ParameterDict(lin_weights)
      self.attn_weights = ParameterDict(attn_weights)
  
      if bias:
          self.bias = ParameterDict(biases)
      else:
          self.register_parameter("bias", None)
  
      self.reset_parameters()
  
file_path: cugraph/python/cugraph-pyg/cugraph_pyg/nn/conv/hetero_gat_conv.py
imports: from typing import Optional, Union
  from collections import defaultdict
  from cugraph.utilities.utils import import_optional
  from pylibcugraphops.pytorch.operators import mha_gat_n2n
  from .base import BaseConv
label_desc: Use image node_id 1 to create a new HeteroGATConv object from inherited base classes: BaseConv with example: obj = HeteroGATConv(in_channels, out_channels, node_types, edge_types, heads, concat, negative_slope, bias, aggr)