class_docstr: The graph transformer operator from the `"Masked Label Prediction:
  Unified Message Passing Model for Semi-Supervised Classification"
  <https://arxiv.org/abs/2009.03509>`_ paper.
  
  .. math::
      \mathbf{x}^{\prime}_i = \mathbf{W}_1 \mathbf{x}_i +
      \sum_{j \in \mathcal{N}(i)} \alpha_{i,j} \mathbf{W}_2 \mathbf{x}_{j},
  
  where the attention coefficients :math:`\alpha_{i,j}` are computed via
  multi-head dot product attention:
  
  .. math::
      \alpha_{i,j} = \textrm{softmax} \left(
      \frac{(\mathbf{W}_3\mathbf{x}_i)^{\top} (\mathbf{W}_4\mathbf{x}_j)}
      {\sqrt{d}} \right)
  
  Args:
      in_channels (int or tuple): Size of each input sample, or :obj:`-1` to
          derive the size from the first input(s) to the forward method.
          A tuple corresponds to the sizes of source and target
          dimensionalities.
      out_channels (int): Size of each output sample.
      heads (int, optional): Number of multi-head-attentions.
          (default: :obj:`1`)
      concat (bool, optional): If set to :obj:`False`, the multi-head
          attentions are averaged instead of concatenated.
          (default: :obj:`True`)
      beta (bool, optional): If set, will combine aggregation and
          skip information via
  
          .. math::
              \mathbf{x}^{\prime}_i = \beta_i \mathbf{W}_1 \mathbf{x}_i +
              (1 - \beta_i) \underbrace{\left(\sum_{j \in \mathcal{N}(i)}
              \alpha_{i,j} \mathbf{W}_2 \vec{x}_j \right)}_{=\mathbf{m}_i}
  
          with :math:`\beta_i = \textrm{sigmoid}(\mathbf{w}_5^{\top}
          [ \mathbf{W}_1 \mathbf{x}_i, \mathbf{m}_i, \mathbf{W}_1
          \mathbf{x}_i - \mathbf{m}_i ])` (default: :obj:`False`)
      edge_dim (int, optional): Edge feature dimensionality (in case
          there are any). Edge features are added to the keys after
          linear transformation, that is, prior to computing the
          attention dot product. They are also added to final values
          after the same linear transformation. The model is:
  
          .. math::
              \mathbf{x}^{\prime}_i = \mathbf{W}_1 \mathbf{x}_i +
              \sum_{j \in \mathcal{N}(i)} \alpha_{i,j} \left(
              \mathbf{W}_2 \mathbf{x}_{j} + \mathbf{W}_6 \mathbf{e}_{ij}
              \right),
  
          where the attention coefficients :math:`\alpha_{i,j}` are now
          computed via:
  
          .. math::
              \alpha_{i,j} = \textrm{softmax} \left(
              \frac{(\mathbf{W}_3\mathbf{x}_i)^{\top}
              (\mathbf{W}_4\mathbf{x}_j + \mathbf{W}_6 \mathbf{e}_{ij})}
              {\sqrt{d}} \right)
  
          (default :obj:`None`)
      bias (bool, optional): If set to :obj:`False`, the layer will not learn
          an additive bias. (default: :obj:`True`)
      root_weight (bool, optional): If set to :obj:`False`, the layer will
          not add the transformed root node features to the output and the
          option  :attr:`beta` is set to :obj:`False`. (default: :obj:`True`)
code: def __init__(
      self,
      in_channels: Union[int, Tuple[int, int]],
      out_channels: int,
      heads: int = 1,
      concat: bool = True,
      beta: bool = False,
      edge_dim: Optional[int] = None,
      bias: bool = True,
      root_weight: bool = True,
  ):
      super().__init__()
  
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.heads = heads
      self.beta = beta and root_weight
      self.root_weight = root_weight
      self.concat = concat
      self.edge_dim = edge_dim
  
      if isinstance(in_channels, int):
          in_channels = (in_channels, in_channels)
  
      Linear = torch_geometric.nn.Linear
  
      self.lin_key = Linear(in_channels[0], heads * out_channels)
      self.lin_query = Linear(in_channels[1], heads * out_channels)
      self.lin_value = Linear(in_channels[0], heads * out_channels)
      if edge_dim is not None:
          self.lin_edge = Linear(
              edge_dim, heads * out_channels, bias=False
          )
      else:
          self.lin_edge = self.register_parameter("lin_edge", None)
  
      if concat:
          self.lin_skip = Linear(
              in_channels[1], heads * out_channels, bias=bias
          )
          if self.beta:
              self.lin_beta = Linear(
                  3 * heads * out_channels, 1, bias=False
              )
          else:
              self.lin_beta = self.register_parameter("lin_beta", None)
      else:
          self.lin_skip = Linear(
              in_channels[1], out_channels, bias=bias
          )
          if self.beta:
              self.lin_beta = Linear(3 * out_channels, 1, bias=False)
          else:
              self.lin_beta = self.register_parameter("lin_beta", None)
  
      self.reset_parameters()
  
file_path: cugraph/python/cugraph-pyg/cugraph_pyg/nn/conv/transformer_conv.py
imports: from typing import Optional, Tuple, Union
  from cugraph.utilities.utils import import_optional
  from pylibcugraphops.pytorch.operators import mha_simple_n2n
  from .base import BaseConv
label_desc: Use image node_id 1 to create a new TransformerConv object from inherited base classes: BaseConv with example: obj = TransformerConv(in_channels, out_channels, heads, concat, beta, edge_dim, bias, root_weight)