class_docstr: Compute node features for each node in the graph.
class_docstr_tok: ["Compute","node","features","for","each","node","in","the","graph","."]
code: def forward(
      self,
      input_nodes: torch.LongTensor,
      in_degree: torch.LongTensor,
      out_degree: torch.LongTensor,
  ) -> torch.Tensor:
      n_graph, n_node = input_nodes.size()[:2]
  
      node_feature = (  # node feature + graph token
          self.atom_encoder(input_nodes).sum(
              dim=-2
          )  # [n_graph, n_node, n_hidden]
          + self.in_degree_encoder(in_degree)
          + self.out_degree_encoder(out_degree)
      )
  
      graph_token_feature = self.graph_token.weight.unsqueeze(0).repeat(
          n_graph, 1, 1
      )
  
      graph_node_feature = torch.cat(
          [graph_token_feature, node_feature], dim=1
      )
  
      return graph_node_feature
  
imports: import math
  from typing import Iterable, Iterator, List, Optional, Tuple, Union
  import torch
  import torch.nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BaseModelOutputWithNoAttention, SequenceClassifierOutput
  from ...modeling_utils import PreTrainedModel
  from ...utils import logging
  from .configuration_graphormer import GraphormerConfig
label_desc: Use image node_id 2 for calling the GraphormerGraphNodeFeature obj's underlying member method code with example usage: obj.forward(input_nodes, in_degree, out_degree) and returns: graph_node_feature