class_docstr: The MscaleOCRNet implementation based on PaddlePaddle.
  The original article refers to
  Tao et al. "HIERARCHICAL MULTI-SCALE ATTENTION FOR SEMANTIC SEGMENTATION"
  (https://arxiv.org/pdf/2005.10821.pdf).
  
  Args:
      num_classes (int): The unique number of target classes.
      backbone (Paddle.nn.Layer): Backbone network.
      backbone_indices (tuple, optional): Two values in the tuple indicate the indices of output of backbone.
          Default: [0].
      mscale (list): The multiple scales for fusion.
          Default: [0.5, 1.0, 2.0].
      pretrained (str, optional): The path or url of pretrained model. 
          Default: None.
class_docstr_tok: ["The","MscaleOCRNet","implementation","based","on","PaddlePaddle",".","The","original","article","refers","to","Tao","et","al",".","``","HIERARCHICAL","MULTI-SCALE","ATTENTION","FOR","SEMANTIC","SEGMENTATION","''","(","https",":","\/\/arxiv.org\/pdf\/2005.10821.pdf",")",".","Args",":","num_classes","(","int",")",":","The","unique","number","of","target","classes",".","backbone","(","Paddle.nn.Layer",")",":","Backbone","network",".","backbone_indices","(","tuple",",","optional",")",":","Two","values","in","the","tuple","indicate","the","indices","of","output","of","backbone",".","Default",":","[","0","]",".","mscale","(","list",")",":","The","multiple","scales","for","fusion",".","Default",":","[","0.5",",","1.0",",","2.0","]",".","pretrained","(","str",",","optional",")",":","The","path","or","url","of","pretrained","model",".","Default",":","None","."]
code: def nscale_forward(self, inputs, scales):
      x_1x = inputs
      scales = sorted(scales, reverse=True)
      pred = paddle.empty([1, 1, 1, 1])
      aux = paddle.empty([1, 1, 1, 1])
  
      is_init = False
  
      if len(scales) < 1:
          raise ValueError("`len(scales)` must be larger than 0.")
  
      scales_tensor = paddle.to_tensor([scales, scales]).transpose(
          (1, 0)
      )
  
      for s in scales_tensor:
          x = F.interpolate(x_1x, scale_factor=s, mode="bilinear")
          outs = self._fwd(x)
          pred_out = outs["pred_out"]
          attn_out = outs["logit_attn"]
          aux_out = outs["aux_out"]
  
          if not is_init:
              is_init = True
              pred = pred_out
              aux = aux_out
          elif s[0] >= 1.0:
              pred = F.interpolate(
                  pred,
                  size=paddle.shape(pred_out)[2:4],
                  mode="bilinear",
              )
              pred = attn_out * pred_out + (1 - attn_out) * pred
              aux = F.interpolate(
                  aux, size=paddle.shape(pred_out)[2:4], mode="bilinear"
              )
              aux = attn_out * aux_out + (1 - attn_out) * aux
          else:
              pred_out = attn_out * pred_out
              aux_out = attn_out * aux_out
              pred_out = F.interpolate(
                  pred_out,
                  size=paddle.shape(pred)[2:4],
                  mode="bilinear",
              )
              aux_out = F.interpolate(
                  aux_out, size=paddle.shape(pred)[2:4], mode="bilinear"
              )
              attn_out = F.interpolate(
                  attn_out,
                  size=paddle.shape(pred)[2:4],
                  mode="bilinear",
              )
              pred = pred_out + (1 - attn_out) * pred
              aux = aux_out + (1 - attn_out) * aux
      logit_list = [aux, pred] if self.training else [pred]
      return logit_list
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.models import layers
  from paddleseg.utils import utils
  from paddleseg.cvlibs import manager, param_init
label_desc: Use image node_id 3 for calling the MscaleOCRNet obj's underlying member method code with example usage: obj.nscale_forward(inputs, scales) and returns: logit_list