class_docstr: Description
  -----------
  The Graph Cross Module used by Graph Cross Networks.
  This module only contains graph cross layers.
  
  Parameters
  ----------
  pool_ratios : Union[float, List[float]]
      The pooling ratios (for keeping nodes) for each layer.
      For example, if `pool_ratio=0.8`, 80\% nodes will be preserved.
      If a single float number is given, all pooling layers will have the
      same pooling ratio.
  in_dim : int
      The number of input node feature channels.
  out_dim : int
      The number of output node feature channels.
  hidden_dim : int
      The number of hidden node feature channels.
  cross_weight : float, optional
      The weight parameter used in graph cross layers
      Default: :obj:`1.0`
  fuse_weight : float, optional
      The weight parameter used at the end of GXN for channel fusion.
      Default: :obj:`1.0`
class_docstr_tok: ["Description","--","--","--","--","--","-","The","Graph","Cross","Module","used","by","Graph","Cross","Networks",".","This","module","only","contains","graph","cross","layers",".","Parameters","--","--","--","--","--","pool_ratios",":","Union","[","float",",","List","[","float","]","]","The","pooling","ratios","(","for","keeping","nodes",")","for","each","layer",".","For","example",",","if","`","pool_ratio=0.8","`",",","80\\","%","nodes","will","be","preserved",".","If","a","single","float","number","is","given",",","all","pooling","layers","will","have","the","same","pooling","ratio",".","in_dim",":","int","The","number","of","input","node","feature","channels",".","out_dim",":","int","The","number","of","output","node","feature","channels",".","hidden_dim",":","int","The","number","of","hidden","node","feature","channels",".","cross_weight",":","float",",","optional","The","weight","parameter","used","in","graph","cross","layers","Default",":",":","obj",":","`","1.0","`","fuse_weight",":","float",",","optional","The","weight","parameter","used","at","the","end","of","GXN","for","channel","fusion",".","Default",":",":","obj",":","`","1.0","`"]
code: def forward(self, graph, feat):
      # start of scale-1
      graph_scale1 = graph
      feat_scale1 = self.start_gcn_scale1(graph_scale1, feat)
      feat_origin = feat_scale1
      feat_scale1_neg = feat_scale1[
          torch.randperm(feat_scale1.size(0))
      ]  # negative samples
      (
          logit_s1,
          scores_s1,
          select_idx_s1,
          non_select_idx_s1,
          feat_down_s1,
      ) = self.index_select_scale1(
          graph_scale1, feat_scale1, feat_scale1_neg
      )
      feat_scale2, graph_scale2 = self.start_pool_s12(
          graph_scale1,
          feat_scale1,
          select_idx_s1,
          non_select_idx_s1,
          scores_s1,
          pool_graph=True,
      )
  
      # start of scale-2
      feat_scale2 = self.start_gcn_scale2(graph_scale2, feat_scale2)
      feat_scale2_neg = feat_scale2[
          torch.randperm(feat_scale2.size(0))
      ]  # negative samples
      (
          logit_s2,
          scores_s2,
          select_idx_s2,
          non_select_idx_s2,
          feat_down_s2,
      ) = self.index_select_scale2(
          graph_scale2, feat_scale2, feat_scale2_neg
      )
      feat_scale3, graph_scale3 = self.start_pool_s23(
          graph_scale2,
          feat_scale2,
          select_idx_s2,
          non_select_idx_s2,
          scores_s2,
          pool_graph=True,
      )
  
      # layer-1
      res_s1_0, res_s2_0, res_s3_0 = (
          feat_scale1,
          feat_scale2,
          feat_scale3,
      )
  
      feat_scale1 = F.relu(self.s1_l1_gcn(graph_scale1, feat_scale1))
      feat_scale2 = F.relu(self.s2_l1_gcn(graph_scale2, feat_scale2))
      feat_scale3 = F.relu(self.s3_l1_gcn(graph_scale3, feat_scale3))
  
      if self.num_cross_layers >= 1:
          feat_s12_fu = self.pool_s12_1(
              graph_scale1,
              feat_scale1,
              select_idx_s1,
              non_select_idx_s1,
              scores_s1,
          )
          feat_s21_fu = self.unpool_s21_1(
              graph_scale1, feat_scale2, select_idx_s1
          )
          feat_s23_fu = self.pool_s23_1(
              graph_scale2,
              feat_scale2,
              select_idx_s2,
              non_select_idx_s2,
              scores_s2,
          )
          feat_s32_fu = self.unpool_s32_1(
              graph_scale2, feat_scale3, select_idx_s2
          )
  
          feat_scale1 = (
              feat_scale1 + self.cross_weight * feat_s21_fu + res_s1_0
          )
          feat_scale2 = (
              feat_scale2
              + self.cross_weight * (feat_s12_fu + feat_s32_fu) / 2
              + res_s2_0
          )
          feat_scale3 = (
              feat_scale3 + self.cross_weight * feat_s23_fu + res_s3_0
          )
  
      # layer-2
      feat_scale1 = F.relu(self.s1_l2_gcn(graph_scale1, feat_scale1))
      feat_scale2 = F.relu(self.s2_l2_gcn(graph_scale2, feat_scale2))
      feat_scale3 = F.relu(self.s3_l2_gcn(graph_scale3, feat_scale3))
  
      if self.num_cross_layers >= 2:
          feat_s12_fu = self.pool_s12_2(
              graph_scale1,
              feat_scale1,
              select_idx_s1,
              non_select_idx_s1,
              scores_s1,
          )
          feat_s21_fu = self.unpool_s21_2(
              graph_scale1, feat_scale2, select_idx_s1
          )
          feat_s23_fu = self.pool_s23_2(
              graph_scale2,
              feat_scale2,
              select_idx_s2,
              non_select_idx_s2,
              scores_s2,
          )
          feat_s32_fu = self.unpool_s32_2(
              graph_scale2, feat_scale3, select_idx_s2
          )
  
          cross_weight = self.cross_weight * 0.05
          feat_scale1 = feat_scale1 + cross_weight * feat_s21_fu
          feat_scale2 = (
              feat_scale2
              + cross_weight * (feat_s12_fu + feat_s32_fu) / 2
          )
          feat_scale3 = feat_scale3 + cross_weight * feat_s23_fu
  
      # layer-3
      feat_scale1 = F.relu(self.s1_l3_gcn(graph_scale1, feat_scale1))
      feat_scale2 = F.relu(self.s2_l3_gcn(graph_scale2, feat_scale2))
      feat_scale3 = F.relu(self.s3_l3_gcn(graph_scale3, feat_scale3))
  
      # final layers
      feat_s3_out = (
          self.end_unpool_s32(graph_scale2, feat_scale3, select_idx_s2)
          + feat_down_s2
      )
      feat_s2_out = self.end_unpool_s21(
          graph_scale1, feat_scale2 + feat_s3_out, select_idx_s1
      )
      feat_agg = (
          feat_scale1
          + self.fuse_weight * feat_s2_out
          + self.fuse_weight * feat_down_s1
      )
      feat_agg = torch.cat((feat_agg, feat_origin), dim=1)
      feat_agg = self.end_gcn(graph_scale1, feat_agg)
  
      return feat_agg, logit_s1, logit_s2
  
file_path: dgl/examples/pytorch/gxn/networks.py
imports: from typing import List, Tuple, Union
  from layers import *
  import dgl.function
  import torch
  import torch.nn
  import torch.nn.functional
  from dgl.nn.pytorch.glob import SortPooling
label_desc: Use image node_id 2 for calling the GraphCrossModule obj's underlying member method code with example usage: obj.forward(graph, feat) and returns: feat_agg,  logit_s1,  logit_s2