class_docstr: The KNet implementation based on PaddlePaddle.
  
  The original article refers to
  Wenwei Zhang, et, al. "K-Net: Towards Unified Image Segmentation"
  (https://arxiv.org/abs/2106.14855).
  
  Args:
      num_classes (int): The unique number of target classes.
      backbone (paddle.nn.Layer): Backbone network.
      backbone_indices (tuple): Four values in the tuple indicate the indices of output of backbone.
      kernel_update_head_params (dict): The params to build KernelUpdateHead.
      kernel_generate_head_params (dict): The params to build KernelGenerateHead.
      num_stages (int, optional): The num of KernelUpdateHead. Default: 3
      channels (int, optional): The channels of intermediate layers. Default: 512.
      enable_auxiliary_loss (bool, optional): A bool value that indicates whether or not to add auxiliary loss. Default: False.
      align_corners (bool, optional): An argument of "F.interpolate". It should be set to False when the feature size is even,
          e.g. 1024x512, otherwise it is True, e.g. 769x769. Default: False.
      dropout_prob (float, optional): Dropout ratio for KNet model. Default: 0.1.
      pretrained (str, optional): The path or url of pretrained model. Default: None.
code: def forward(self, x):
      feats = self.backbone(x)
      if self.enable_auxiliary_loss:
          aux_out = self.aux_head(feats[2])
      feats = [feats[i] for i in self.backbone_indices]
      sem_seg, feats, seg_kernels = self.kernel_generate_head(feats)
      stage_segs = [sem_seg]
      for i in range(self.num_stages):
          sem_seg, seg_kernels = self.kernel_update_head[i](
              feats, seg_kernels, sem_seg
          )
          stage_segs.append(sem_seg)
      if self.training:
          if self.enable_auxiliary_loss:
              stage_segs.append(aux_out)
          for i, v in enumerate(stage_segs):
              stage_segs[i] = F.interpolate(
                  v,
                  paddle.shape(x)[2:],
                  mode="bilinear",
                  align_corners=self.align_corners,
              )
          return stage_segs
      # only return the prediction of the last stage during testing
      return [
          F.interpolate(
              stage_segs[-1],
              paddle.shape(x)[2:],
              mode="bilinear",
              align_corners=self.align_corners,
          )
      ]
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg import utils
  from paddleseg.cvlibs import manager
  from paddleseg.models import layers
  from .upernet import UPerNetHead
label_desc: Use image node_id 2 for calling the KNet obj's underlying member method code with example usage: obj.forward(x) and returns: list, stage_segs