docstr: Args:
      x: generated subgraph node features so far with shape (1, N, 9), some part of the x is masked
      adj: generated subgraph adacency features so far with shape (1, 4, N, N) some part of the adj is masked
      latent: sample latent vector with shape (1, 9) (mode == 0) or (1, 4) (mode == 1)
      mode: generation mode. if mode == 0, generate a new node, if mode == 1, generate a new edge
      edge_index [1, 2]
  
  Returns:
      out: generated node/edge features with shape (1, 9) (mode == 0) or (1, 4) , (mode == 1)
docstr_tok: ["Args",":","x",":","generated","subgraph","node","features","so","far","with","shape","(","1",",","N",",","9",")",",","some","part","of","the","x","is","masked","adj",":","generated","subgraph","adacency","features","so","far","with","shape","(","1",",","4",",","N",",","N",")","some","part","of","the","adj","is","masked","latent",":","sample","latent","vector","with","shape","(","1",",","9",")","(","mode","==","0",")","or","(","1",",","4",")","(","mode","==","1",")","mode",":","generation","mode",".","if","mode","==","0",",","generate","a","new","node",",","if","mode","==","1",",","generate","a","new","edge","edge_index","[","1",",","2","]","Returns",":","out",":","generated","node\/edge","features","with","shape","(","1",",","9",")","(","mode","==","0",")","or","(","1",",","4",")",",","(","mode","==","1",")"]
code: def reverse(self, x, adj, latent, mode, edge_index=None):
      """
      Args:
          x: generated subgraph node features so far with shape (1, N, 9), some part of the x is masked
          adj: generated subgraph adacency features so far with shape (1, 4, N, N) some part of the adj is masked
          latent: sample latent vector with shape (1, 9) (mode == 0) or (1, 4) (mode == 1)
          mode: generation mode. if mode == 0, generate a new node, if mode == 1, generate a new edge
          edge_index [1, 2]
  
      Returns:
          out: generated node/edge features with shape (1, 9) (mode == 0) or (1, 4) , (mode == 1)
      """
  
      assert (
          mode == 0 or edge_index is not None
      ), "if you want to generate edge, you must specify edge_index"
      assert x.size(0) == 1
      assert adj.size(0) == 1
      assert edge_index is None or (
          edge_index.size(0) == 1 and edge_index.size(1) == 2
      )
  
      if mode == 0:  # (1, 9)
          st_net = self.node_st_net
          emb = self._get_embs_node(x, adj)
  
      else:  # mode == 1
          st_net = self.edge_st_net
          emb = self._get_embs_edge(x, adj, edge_index)
  
      for i in reversed(range(self.num_flow_layer)):
          t = st_net[i](emb)
          latent = one_hot_minus(latent, t)
  
      return latent
  
file_path: DIG/dig/ggraph/method/GraphDF/model/disgraphaf.py
imports: import torch
  from torch import nn
  from .st_net import ST_Dis
  from .df_utils import one_hot_add, one_hot_minus
  from .rgcn import RGCN
label_desc: Use image node_id 5 for calling the DisGraphAF obj's underlying member method code with example usage: obj.reverse(x, adj, latent, mode, edge_index) and returns: latent