code: def avgpooling_factory(
      dim: int,
  ) -> type[nn.AvgPool1d | nn.AvgPool2d | nn.AvgPool3d]:
      """
      Average pooling layers in 1,2,3 dimensions.
  
      Args:
          dim: desired dimension of the average pooling layer
  
      Returns:
          AvgPool[dim]d
      """
      types = (nn.AvgPool1d, nn.AvgPool2d, nn.AvgPool3d)
      return types[dim - 1]
  
imports: from __future__ import annotations
  import warnings
  from collections.abc import Callable
  from typing import Any
  import torch.nn
  from monai.networks.utils import has_nvfuser_instance_norm
  from monai.utils import ComponentStore, look_up_option, optional_import
label_desc: Use image node_id 14 for calling a global function with example usage: avgpooling_factory(dim) and returns: types