code: def avg_max_reduce_hw_helper(x, is_training, use_concat=True):
      assert not isinstance(x, (list, tuple))
      avg_pool = F.adaptive_avg_pool2d(x, 1)
      # TODO(pjc): when axis=[2, 3], the paddle.max api has bug for training.
      if is_training:
          max_pool = F.adaptive_max_pool2d(x, 1)
      else:
          max_pool = paddle.max(x, axis=[2, 3], keepdim=True)
  
      if use_concat:
          res = paddle.concat([avg_pool, max_pool], axis=1)
      else:
          res = [avg_pool, max_pool]
      return res
  
file_path: PaddleSeg/paddleseg/models/layers/tensor_fusion_helper.py
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
label_desc: Use image node_id 2 for calling a global function with example usage: avg_max_reduce_hw_helper(x, is_training, use_concat) and returns: res