class_docstr: Graph attention layer with edge features from `SCENE
  <https://arxiv.org/pdf/2301.03512.pdf>`__
  
  .. math::
  
      \mathbf{v}_i^\prime = \mathbf{\Theta}_\mathrm{s} \cdot \mathbf{v}_i +
      \sum\limits_{j \in \mathcal{N}(v_i)} \alpha_{j, i} \left( \mathbf{\Theta}_\mathrm{n}
      \cdot \mathbf{v}_j + \mathbf{\Theta}_\mathrm{e} \cdot \mathbf{e}_{j,i} \right)
  
  where :math:`\mathbf{\Theta}` is used to denote learnable weight matrices
  for the transformation of features of the node to update (s=self),
  neighboring nodes (n=neighbor) and edge features (e=edge).
  Attention weights are obtained by
  
  .. math::
  
      \alpha_{j, i} = \mathrm{softmax}_i \Big( \mathrm{LeakyReLU} \big( \mathbf{a}^T
      [ \mathbf{\Theta}_\mathrm{n} \cdot \mathbf{v}_i || \mathbf{\Theta}_\mathrm{n}
      \cdot \mathbf{v}_j || \mathbf{\Theta}_\mathrm{e} \cdot \mathbf{e}_{j,i} ] \big) \Big)
  
  with :math:`\mathbf{a}` corresponding to a learnable vector.
  :math:`\mathrm{softmax_i}` stands for the normalization by all incoming edges of node :math:`i`.
  
  Parameters
  ----------
  in_feats : int, or pair of ints
      Input feature size; i.e, the number of dimensions of :math:`\mathbf{v}_i`.
      GATConv can be applied on homogeneous graph and unidirectional
      `bipartite graph <https://docs.dgl.ai/generated/dgl.bipartite.html?highlight=bipartite>`__.
      If the layer is to be applied to a unidirectional bipartite graph, ``in_feats``
      specifies the input feature size on both the source and destination nodes.  If
      a scalar is given, the source and destination node feature size would take the
      same value.
  edge_feats: int
      Edge feature size; i.e., the number of dimensions of :math:\mathbf{e}_{j,i}`.
  out_feats : int
      Output feature size; i.e, the number of dimensions of :math:`\mathbf{v}_i^\prime`.
  num_heads : int
      Number of heads in Multi-Head Attention.
  feat_drop : float, optional
      Dropout rate on feature. Defaults: ``0``.
  attn_drop : float, optional
      Dropout rate on attention weight. Defaults: ``0``.
  negative_slope : float, optional
      LeakyReLU angle of negative slope. Defaults: ``0.2``.
  residual : bool, optional
      If True, use residual connection. Defaults: ``False``.
  activation : callable activation function/layer or None, optional.
      If not None, applies an activation function to the updated node features.
      Default: ``None``.
  allow_zero_in_degree : bool, optional
      If there are 0-in-degree nodes in the graph, output for those nodes will be invalid
      since no message will be passed to those nodes. This is harmful for some applications
      causing silent performance regression. This module will raise a DGLError if it detects
      0-in-degree nodes in input graph. By setting ``True``, it will suppress the check
      and let the users handle it by themselves. Defaults: ``False``.
  bias : bool, optional
      If True, learns a bias term. Defaults: ``True``.
  
  Note
  ----
  Zero in-degree nodes will lead to invalid output value. This is because no message
  will be passed to those nodes, the aggregation function will be appied on empty input.
  A common practice to avoid this is to add a self-loop for each node in the graph if
  it is homogeneous, which can be achieved by:
  
  >>> g = ... # a DGLGraph
  >>> g = dgl.add_self_loop(g)
  
  Calling ``add_self_loop`` will not work for some graphs, for example, heterogeneous graph
  since the edge type can not be decided for self_loop edges. Set ``allow_zero_in_degree``
  to ``True`` for those cases to unblock the code and handle zero-in-degree nodes manually.
  A common practise to handle this is to filter out the nodes with zero-in-degree when use
  after conv.
  
  Examples
  ----------
  >>> import dgl
  >>> import numpy as np
  >>> import torch as th
  >>> from dgl.nn import EdgeGATConv
  
  >>> # Case 1: Homogeneous graph.
  >>> num_nodes, num_edges = 8, 30
  >>> # Generate a graph.
  >>> graph = dgl.rand_graph(num_nodes,num_edges)
  >>> node_feats = th.rand((num_nodes, 20))
  >>> edge_feats = th.rand((num_edges, 12))
  >>> edge_gat = EdgeGATConv(
  ...     in_feats=20,
  ...     edge_feats=12,
  ...     out_feats=15,
  ...     num_heads=3,
  ... )
  >>> # Forward pass.
  >>> new_node_feats = edge_gat(graph, node_feats, edge_feats)
  >>> new_node_feats.shape
  torch.Size([8, 3, 15]) torch.Size([30, 3, 10])
  
  >>> # Case 2: Unidirectional bipartite graph.
  >>> u = [0, 1, 0, 0, 1]
  >>> v = [0, 1, 2, 3, 2]
  >>> g = dgl.heterograph({('A', 'r', 'B'): (u, v)})
  >>> u_feat = th.tensor(np.random.rand(2, 25).astype(np.float32))
  >>> v_feat = th.tensor(np.random.rand(4, 30).astype(np.float32))
  >>> nfeats = (u_feat,v_feat)
  >>> efeats = th.tensor(np.random.rand(5, 15).astype(np.float32))
  >>> in_feats = (25,30)
  >>> edge_feats = 15
  >>> out_feats = 10
  >>> num_heads = 3
  >>> egat_model =  EdgeGATConv(
  ...     in_feats,
  ...     edge_feats,
  ...     out_feats,
  ...     num_heads,
  ... )
  >>> # Forward pass.
  >>> new_node_feats, attention_weights = egat_model(g, nfeats, efeats, get_attention=True)
  >>> new_node_feats.shape, attention_weights.shape
  (torch.Size([4, 3, 10]), torch.Size([5, 3, 1]))
docstr: Description
  -----------
  Set allow_zero_in_degree flag.
  
  Parameters
  ----------
  set_value : bool
      The value to be set to the flag.
code: def set_allow_zero_in_degree(self, set_value):
      r"""
  
      Description
      -----------
      Set allow_zero_in_degree flag.
  
      Parameters
      ----------
      set_value : bool
          The value to be set to the flag.
      """
      self._allow_zero_in_degree = set_value
  
file_path: dgl/python/dgl/nn/pytorch/conv/edgegatconv.py
imports: import torch
  from torch import nn
  from ....None import function
  from ....base import DGLError
  from ....utils import expand_as_pair
  from ...functional import edge_softmax
label_desc: Use image node_id 3 for calling the EdgeGATConv obj's underlying member method code with example usage: obj.set_allow_zero_in_degree(set_value) without return types