docstr: # The F.adaptive_avg_pool2d does not support the (H, W) be Tensor,
  # so exporting the inference model will raise error.
  _, _, H, W = inputs[-1].shape
  H = (H - 1) // self.stride + 1
  W = (W - 1) // self.stride + 1
  return paddle.concat(
      [F.adaptive_avg_pool2d(inp, (H, W)) for inp in inputs], axis=1)
docstr_tok: ["#","The","F.adaptive_avg_pool2d","does","not","support","the","(","H",",","W",")","be","Tensor",",","#","so","exporting","the","inference","model","will","raise","error",".","_",",","_",",","H",",","W","=","inputs","[","-1","]",".shape","H","=","(","H","-","1",")","\/\/","self.stride","+","1","W","=","(","W","-","1",")","\/\/","self.stride","+","1","return","paddle.concat","(","[","F.adaptive_avg_pool2d","(","inp",",","(","H",",","W",")",")","for","inp","in","inputs","]",",","axis=1",")"]
code: def forward(self, inputs):
      """
      # The F.adaptive_avg_pool2d does not support the (H, W) be Tensor,
      # so exporting the inference model will raise error.
      _, _, H, W = inputs[-1].shape
      H = (H - 1) // self.stride + 1
      W = (W - 1) // self.stride + 1
      return paddle.concat(
          [F.adaptive_avg_pool2d(inp, (H, W)) for inp in inputs], axis=1)
      """
      out = []
      ks = 2 ** len(inputs)
      stride = self.stride ** len(inputs)
      for x in inputs:
          x = F.avg_pool2d(x, int(ks), int(stride))
          ks /= 2
          stride /= 2
          out.append(x)
      out = paddle.concat(out, axis=1)
      return out
  
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 2 for calling the PyramidPoolAgg obj's underlying member method code with example usage: obj.forward(inputs) and returns: out