docstr: :param x:   (batch, N, 9)
  :param adj: (batch, 4, N, N)
  
  :param x_deq: (batch, N, 9)
  :param adj_deq:  (batch, edge_num, 4)
  :return:
docstr_tok: [":","param","x",":","(","batch",",","N",",","9",")",":","param","adj",":","(","batch",",","4",",","N",",","N",")",":","param","x_deq",":","(","batch",",","N",",","9",")",":","param","adj_deq",":","(","batch",",","edge_num",",","4",")",":","return",":"]
code: def forward(self, x, adj, x_deq, adj_deq):
      """
      :param x:   (batch, N, 9)
      :param adj: (batch, 4, N, N)
  
      :param x_deq: (batch, N, 9)
      :param adj_deq:  (batch, edge_num, 4)
      :return:
      """
      # inputs for RelGCNs
      batch_size = x.size(0)
      graph_emb_node, graph_node_emb_edge = self._get_embs(x, adj)
      x_deq = x_deq.view(-1, self.num_node_type)  # (batch *N, 9)
      adj_deq = adj_deq.view(
          -1, self.num_edge_type
      )  # (batch*(repeat_num-N), 4)
  
      for i in range(self.num_flow_layer):
          # update x_deq
          node_s, node_t = self.node_st_net[i](graph_emb_node)
          if self.st_type == "sigmoid":
              x_deq = x_deq * node_s + node_t
          elif self.st_type == "exp":
              node_s = node_s.exp()
              x_deq = (x_deq + node_t) * node_s
          elif self.st_type == "softplus":
              x_deq = (x_deq + node_t) * node_s
          else:
              raise ValueError("unsupported st type!")
  
          if torch.isnan(x_deq).any():
              raise RuntimeError(
                  "x_deq has NaN entries after transformation at layer %d"
                  % i
              )
  
          if i == 0:
              x_log_jacob = (torch.abs(node_s) + 1e-20).log()
          else:
              x_log_jacob += (torch.abs(node_s) + 1e-20).log()
  
          # update adj_deq
          edge_s, edge_t = self.edge_st_net[i](graph_node_emb_edge)
          if self.st_type == "sigmoid":
              adj_deq = adj_deq * edge_s + edge_t
          elif self.st_type == "exp":
              edge_s = edge_s.exp()
              adj_deq = (adj_deq + edge_t) * edge_s
          elif self.st_type == "softplus":
              adj_deq = (adj_deq + edge_t) * edge_s
          else:
              raise ValueError("unsupported st type!")
  
          if torch.isnan(adj_deq).any():
              raise RuntimeError(
                  "adj_deq has NaN entries after transformation at layer %d"
                  % i
              )
  
          if i == 0:
              adj_log_jacob = (torch.abs(edge_s) + 1e-20).log()
          else:
              adj_log_jacob += (torch.abs(edge_s) + 1e-20).log()
  
      x_deq = x_deq.view(batch_size, -1)  # (batch, N * 9)
      adj_deq = adj_deq.view(
          batch_size, -1
      )  # (batch, (repeat_num-N) * 4)
      x_log_jacob = x_log_jacob.view(batch_size, -1).sum(-1)  # (batch)
      adj_log_jacob = adj_log_jacob.view(batch_size, -1).sum(
          -1
      )  # (batch)
  
      return [x_deq, adj_deq], [x_log_jacob, adj_log_jacob]
  
file_path: DIG/dig/ggraph/method/GraphAF/model/graphaf.py
imports: import numpy
  import torch
  import torch.nn
  from .rgcn import *
  from .st_net import *
label_desc: Use image node_id 2 for calling the MaskedGraphAF obj's underlying member method code with example usage: obj.forward(x, adj, x_deq, adj_deq) and returns: list,  list