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 __init__(
      self,
      pool_ratios: Union[float, List[float]],
      in_dim: int,
      out_dim: int,
      hidden_dim: int,
      cross_weight: float = 1.0,
      fuse_weight: float = 1.0,
      dist: int = 1,
      num_cross_layers: int = 2,
  ):
      super(GraphCrossModule, self).__init__()
      if isinstance(pool_ratios, float):
          pool_ratios = (pool_ratios, pool_ratios)
      self.cross_weight = cross_weight
      self.fuse_weight = fuse_weight
      self.num_cross_layers = num_cross_layers
  
      # build network
      self.start_gcn_scale1 = GraphConvWithDropout(in_dim, hidden_dim)
      self.start_gcn_scale2 = GraphConvWithDropout(
          hidden_dim, hidden_dim
      )
      self.end_gcn = GraphConvWithDropout(2 * hidden_dim, out_dim)
  
      self.index_select_scale1 = IndexSelect(
          pool_ratios[0], hidden_dim, act="prelu", dist=dist
      )
      self.index_select_scale2 = IndexSelect(
          pool_ratios[1], hidden_dim, act="prelu", dist=dist
      )
      self.start_pool_s12 = GraphPool(hidden_dim)
      self.start_pool_s23 = GraphPool(hidden_dim)
      self.end_unpool_s21 = GraphUnpool(hidden_dim)
      self.end_unpool_s32 = GraphUnpool(hidden_dim)
  
      self.s1_l1_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
      self.s1_l2_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
      self.s1_l3_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
  
      self.s2_l1_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
      self.s2_l2_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
      self.s2_l3_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
  
      self.s3_l1_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
      self.s3_l2_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
      self.s3_l3_gcn = GraphConvWithDropout(hidden_dim, hidden_dim)
  
      if num_cross_layers >= 1:
          self.pool_s12_1 = GraphPool(hidden_dim, use_gcn=True)
          self.unpool_s21_1 = GraphUnpool(hidden_dim)
          self.pool_s23_1 = GraphPool(hidden_dim, use_gcn=True)
          self.unpool_s32_1 = GraphUnpool(hidden_dim)
      if num_cross_layers >= 2:
          self.pool_s12_2 = GraphPool(hidden_dim, use_gcn=True)
          self.unpool_s21_2 = GraphUnpool(hidden_dim)
          self.pool_s23_2 = GraphPool(hidden_dim, use_gcn=True)
          self.unpool_s32_2 = GraphUnpool(hidden_dim)
  
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 1 to create a new GraphCrossModule object from inherited base classes: torch.nn with example: obj = GraphCrossModule(pool_ratios, in_dim, out_dim, hidden_dim, cross_weight, fuse_weight, dist, num_cross_layers)