class_docstr: Refiner refines the coarse output to full resolution.
  
  Args:
      kernel_size: The convolution kernel_size. Options: [1, 3]. Default: 3.
class_docstr_tok: ["Refiner","refines","the","coarse","output","to","full","resolution",".","Args",":","kernel_size",":","The","convolution","kernel_size",".","Options",":","[","1",",","3","]",".","Default",":","3","."]
docstr: Args：
      src: (B, 3, H, W) full resolution source image.
      pha: (B, 1, Hc, Wc) coarse alpha prediction.
      err: (B, 1, Hc, Hc) coarse error prediction.
      hid: (B, 32, Hc, Hc) coarse hidden encoding.
      tri: (B, 1, Hc, Hc) trimap prediction.
docstr_tok: ["Args\uff1a","src",":","(","B",",","3",",","H",",","W",")","full","resolution","source","image",".","pha",":","(","B",",","1",",","Hc",",","Wc",")","coarse","alpha","prediction",".","err",":","(","B",",","1",",","Hc",",","Hc",")","coarse","error","prediction",".","hid",":","(","B",",","32",",","Hc",",","Hc",")","coarse","hidden","encoding",".","tri",":","(","B",",","1",",","Hc",",","Hc",")","trimap","prediction","."]
code: def forward(self, src, pha, err, hid, tri):
      """
      Args：
          src: (B, 3, H, W) full resolution source image.
          pha: (B, 1, Hc, Wc) coarse alpha prediction.
          err: (B, 1, Hc, Hc) coarse error prediction.
          hid: (B, 32, Hc, Hc) coarse hidden encoding.
          tri: (B, 1, Hc, Hc) trimap prediction.
      """
      h_full, w_full = paddle.shape(src)[2:]
      h_half, w_half = h_full // 2, w_full // 2
      h_quat, w_quat = h_full // 4, w_full // 4
  
      x = paddle.concat([hid, pha, tri], axis=1)
      x = F.interpolate(
          x,
          paddle.stack((h_half, w_half)).squeeze(),
          mode="bilinear",
          align_corners=False,
      )
      y = F.interpolate(
          src,
          paddle.stack((h_half, w_half)).squeeze(),
          mode="bilinear",
          align_corners=False,
      )
  
      if self.kernel_size == 3:
          x = F.pad(x, [3, 3, 3, 3])
          y = F.pad(y, [3, 3, 3, 3])
  
      x = self.conv1(paddle.concat([x, y], axis=1))
      x = self.conv2(x)
  
      if self.kernel_size == 3:
          x = F.interpolate(
              x, paddle.stack((h_full + 4, w_full + 4)).squeeze()
          )
          y = F.pad(src, [2, 2, 2, 2])
      else:
          x = F.interpolate(
              x,
              paddle.stack((h_full, w_full)).squeeze(),
              mode="nearest",
          )
          y = src
  
      x = self.conv3(paddle.concat([x, y], axis=1))
      x = self.conv4(x)
  
      pha = x
      return pha
  
imports: from collections import defaultdict
  import time
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import paddleseg
  from paddleseg.models import layers
  from paddleseg import utils
  from paddleseg.cvlibs import manager
  from ppmatting.models.losses import MRSD
label_desc: Use image node_id 2 for calling the Refiner obj's underlying member method code with example usage: obj.forward(src, pha, err, hid, tri) and returns: pha