code: def __init__(self, in_chan, mid_chan, mid_num=1, out_channels=1):
      super().__init__()
      self.conv = layers.ConvBNReLU(
          in_chan,
          mid_chan,
          kernel_size=3,
          stride=1,
          padding=1,
          bias_attr=False,
      )
      self.mid_conv = nn.LayerList(
          [
              layers.ConvBNReLU(
                  mid_chan,
                  mid_chan,
                  kernel_size=3,
                  stride=1,
                  padding=1,
                  bias_attr=False,
              )
              for i in range(mid_num - 1)
          ]
      )
      self.conv_out = nn.Conv2D(
          mid_chan, out_channels, kernel_size=1, bias_attr=False
      )
  
imports: from functools import partial
  from collections import defaultdict
  import paddle
  import paddle.nn
  import paddle.nn.functional
  import paddleseg
  from paddleseg import utils
  from paddleseg.models import layers
  from paddleseg.cvlibs import manager
  from paddleseg.models.backbones.transformer_utils import Identity, DropPath
  from ppmatting.models.layers import MLFF
  from ppmatting.models.losses import MRSD, GradientLoss
label_desc: Use image node_id 1 to create a new MattingHead object from inherited base classes: nn with example: obj = MattingHead(in_chan, mid_chan, mid_num, out_channels)