class_docstr: ## Graph Attention Network v2 (GATv2)
  
  This graph attention network has two [graph attention layers](index.html).
class_docstr_tok: ["#","#","Graph","Attention","Network","v2","(","GATv2",")","This","graph","attention","network","has","two","[","graph","attention","layers","]","(","index.html",")","."]
docstr: * `x` is the features vectors of shape `[n_nodes, in_features]`
  * `adj_mat` is the adjacency matrix of the form
   `[n_nodes, n_nodes, n_heads]` or `[n_nodes, n_nodes, 1]`
docstr_tok: ["*","`","x","`","is","the","features","vectors","of","shape","`","[","n_nodes",",","in_features","]","`","*","`","adj_mat","`","is","the","adjacency","matrix","of","the","form","`","[","n_nodes",",","n_nodes",",","n_heads","]","`","or","`","[","n_nodes",",","n_nodes",",","1","]","`"]
code: def forward(self, x: torch.Tensor, adj_mat: torch.Tensor):
      """
      * `x` is the features vectors of shape `[n_nodes, in_features]`
      * `adj_mat` is the adjacency matrix of the form
       `[n_nodes, n_nodes, n_heads]` or `[n_nodes, n_nodes, 1]`
      """
      # Apply dropout to the input
      x = self.dropout(x)
      # First graph attention layer
      x = self.layer1(x, adj_mat)
      # Activation function
      x = self.activation(x)
      # Dropout
      x = self.dropout(x)
      # Output layer (without activation) for logits
      return self.output(x, adj_mat)
  
file_path: annotated_deep_learning_paper_implementations/labml_nn/graphs/gatv2/experiment.py
imports: import torch
  from torch import nn
  from labml import experiment
  from labml.configs import option
  from labml_helpers.module import Module
  from labml_nn.graphs.gat.experiment import Configs
  from labml_nn.graphs.gatv2 import GraphAttentionV2Layer
label_desc: Use image node_id 2 for calling the GATv2 obj's underlying member method code with example usage: obj.forward(x, adj_mat) and returns: self