code: def forward(self, input, targets):
      relations, texts, x = input
      node_nums, char_nums = [], []
      for text in texts:
          node_nums.append(text.shape[0])
          char_nums.append(paddle.sum((text > -1).astype(int), axis=-1))
  
      max_num = max([char_num.max() for char_num in char_nums])
      all_nodes = paddle.concat(
          [
              paddle.concat(
                  [
                      text,
                      paddle.zeros(
                          (text.shape[0], max_num - text.shape[1])
                      ),
                  ],
                  -1,
              )
              for text in texts
          ]
      )
      temp = paddle.clip(all_nodes, min=0).astype(int)
      embed_nodes = self.node_embed(temp)
      rnn_nodes, _ = self.rnn(embed_nodes)
  
      b, h, w = rnn_nodes.shape
      nodes = paddle.zeros([b, w])
      all_nums = paddle.concat(char_nums)
      valid = paddle.nonzero((all_nums > 0).astype(int))
      temp_all_nums = (
          (paddle.gather(all_nums, valid) - 1)
          .unsqueeze(-1)
          .unsqueeze(-1)
      )
      temp_all_nums = paddle.expand(
          temp_all_nums,
          [
              temp_all_nums.shape[0],
              temp_all_nums.shape[1],
              rnn_nodes.shape[-1],
          ],
      )
      temp_all_nodes = paddle.gather(rnn_nodes, valid)
      N, C, A = temp_all_nodes.shape
      one_hot = F.one_hot(
          temp_all_nums[:, 0, :], num_classes=C
      ).transpose([0, 2, 1])
      one_hot = paddle.multiply(
          temp_all_nodes, one_hot.astype("float32")
      ).sum(axis=1, keepdim=True)
      t = one_hot.expand([N, 1, A]).squeeze(1)
      nodes = paddle.scatter(nodes, valid.squeeze(1), t)
  
      if x is not None:
          nodes = self.fusion([x, nodes])
  
      all_edges = paddle.concat(
          [rel.reshape([-1, rel.shape[-1]]) for rel in relations]
      )
      embed_edges = self.edge_embed(all_edges.astype("float32"))
      embed_edges = F.normalize(embed_edges)
  
      for gnn_layer in self.gnn_layers:
          nodes, cat_nodes = gnn_layer(nodes, embed_edges, node_nums)
  
      node_cls, edge_cls = self.node_cls(nodes), self.edge_cls(
          cat_nodes
      )
      return node_cls, edge_cls
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import paddle
  from paddle import nn
  import paddle.nn.functional
  from paddle import ParamAttr
label_desc: Use image node_id 2 for calling the SDMGRHead obj's underlying member method code with example usage: obj.forward(input, targets) and returns: node_cls,  edge_cls