code: def avg_pool_nd(dims, *args, **kwargs):
      """
      Create a 1D, 2D, or 3D average pooling module.
      """
      if dims == 1:
          return nn.AvgPool1D(*args, **kwargs)
      elif dims == 2:
          return nn.AvgPool2D(*args, **kwargs)
      elif dims == 3:
          return nn.AvgPool3D(*args, **kwargs)
      raise ValueError(f"unsupported dimensions: {dims}")
  
file_path: PaddleHub/modules/image/text_to_image/disco_diffusion_cnclip_vitb16/reverse_diffusion/model/nn.py
imports: import math
  import paddle
  import paddle.nn
label_desc: Use image node_id 3 for calling a global function with example usage: avg_pool_nd(dims) and returns: nn, nn, nn