class_docstr: The GSCNNHead implementation based on PaddlePaddle.
  Args:
      num_classes (int): The unique number of target classes.
      backbone_indices (tuple): Two values in the tuple indicate the indices of output of backbone.
          the first index will be taken as a low-level feature in Decoder component;
          the last one will be taken as input of ASPP component; the second to fourth
          will be taken as input for GCL component.
          Usually backbone consists of four downsampling stage, and return an output of
          each stage. If we set it as (0, 1, 2, 3), it means taking feature map of the first
          stage in backbone as low-level feature used in Decoder, feature map of the fourth
          stage as input of ASPP, and the feature map of the second to fourth stage as input of GCL.
      backbone_channels (tuple): The channels of output of backbone.
      aspp_ratios (tuple): The dilation rates using in ASSP module.
      aspp_out_channels (int): The output channels of ASPP module.
      align_corners (bool): An argument of F.interpolate. It should be set to False when the output size of feature
          is even, e.g. 1024x512, otherwise it is True, e.g. 769x769.
class_docstr_tok: ["The","GSCNNHead","implementation","based","on","PaddlePaddle",".","Args",":","num_classes","(","int",")",":","The","unique","number","of","target","classes",".","backbone_indices","(","tuple",")",":","Two","values","in","the","tuple","indicate","the","indices","of","output","of","backbone",".","the","first","index","will","be","taken","as","a","low-level","feature","in","Decoder","component",";","the","last","one","will","be","taken","as","input","of","ASPP","component",";","the","second","to","fourth","will","be","taken","as","input","for","GCL","component",".","Usually","backbone","consists","of","four","downsampling","stage",",","and","return","an","output","of","each","stage",".","If","we","set","it","as","(","0",",","1",",","2",",","3",")",",","it","means","taking","feature","map","of","the","first","stage","in","backbone","as","low-level","feature","used","in","Decoder",",","feature","map","of","the","fourth","stage","as","input","of","ASPP",",","and","the","feature","map","of","the","second","to","fourth","stage","as","input","of","GCL",".","backbone_channels","(","tuple",")",":","The","channels","of","output","of","backbone",".","aspp_ratios","(","tuple",")",":","The","dilation","rates","using","in","ASSP","module",".","aspp_out_channels","(","int",")",":","The","output","channels","of","ASPP","module",".","align_corners","(","bool",")",":","An","argument","of","F.interpolate",".","It","should","be","set","to","False","when","the","output","size","of","feature","is","even",",","e.g",".","1024x512",",","otherwise","it","is","True",",","e.g",".","769x769","."]
code: def forward(self, x, feat_list, s_input):
      input_shape = paddle.shape(x)
      m1f = F.interpolate(
          s_input,
          input_shape[2:],
          mode="bilinear",
          align_corners=self.align_corners,
      )
  
      l1, l2, l3 = [
          feat_list[self.backbone_indices[i]]
          for i in range(1, len(self.backbone_indices))
      ]
      s1 = F.interpolate(
          self.dsn1(l1),
          input_shape[2:],
          mode="bilinear",
          align_corners=self.align_corners,
      )
      s2 = F.interpolate(
          self.dsn2(l2),
          input_shape[2:],
          mode="bilinear",
          align_corners=self.align_corners,
      )
      s3 = F.interpolate(
          self.dsn3(l3),
          input_shape[2:],
          mode="bilinear",
          align_corners=self.align_corners,
      )
  
      # Get image gradient
      im_arr = x.numpy().transpose((0, 2, 3, 1))
      im_arr = ((im_arr * 0.5 + 0.5) * 255).astype(np.uint8)
      canny = np.zeros(
          (input_shape[0], 1, input_shape[2], input_shape[3])
      )
      for i in range(input_shape[0]):
          canny[i] = cv2.Canny(im_arr[i], 10, 100)
      canny = canny / 255
      canny = paddle.to_tensor(canny).astype("float32")
      canny.stop_gradient = True
  
      cs = self.res1(m1f)
      cs = F.interpolate(
          cs,
          input_shape[2:],
          mode="bilinear",
          align_corners=self.align_corners,
      )
      cs = self.d1(cs)
      cs = self.gate1(cs, s1)
  
      cs = self.res2(cs)
      cs = F.interpolate(
          cs,
          input_shape[2:],
          mode="bilinear",
          align_corners=self.align_corners,
      )
      cs = self.d2(cs)
      cs = self.gate2(cs, s2)
  
      cs = self.res3(cs)
      cs = F.interpolate(
          cs,
          input_shape[2:],
          mode="bilinear",
          align_corners=self.align_corners,
      )
      cs = self.d3(cs)
      cs = self.gate3(cs, s3)
  
      cs = self.fuse(cs)
      cs = F.interpolate(
          cs,
          input_shape[2:],
          mode="bilinear",
          align_corners=self.align_corners,
      )
      edge_out = F.sigmoid(cs)  # Output of shape stream
  
      cat = paddle.concat([edge_out, canny], axis=1)
      acts = self.cw(cat)
      acts = F.sigmoid(acts)  # Input of fusion module
  
      x = self.aspp(l3, acts)
  
      low_level_feat = feat_list[self.backbone_indices[0]]
      logit = self.decoder(x, low_level_feat)
      logit_list = [logit, edge_out]
      return logit_list
  
imports: import cv2
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager
  from paddleseg.models import layers
  from paddleseg.models.backbones import resnet_vd
  from paddleseg.models import deeplab
  from paddleseg.utils import utils
label_desc: Use image node_id 2 for calling the GSCNNHead obj's underlying member method code with example usage: obj.forward(x, feat_list, s_input) and returns: logit_list