code: def adaptive_avgpooling_factory(
      dim: int,
  ) -> type[
      nn.AdaptiveAvgPool1d | nn.AdaptiveAvgPool2d | nn.AdaptiveAvgPool3d
  ]:
      """
      Adaptive average pooling layers in 1,2,3 dimensions.
  
      Args:
          dim: desired dimension of the adaptive average pooling layer
  
      Returns:
          AdaptiveAvgPool[dim]d
      """
      types = (
          nn.AdaptiveAvgPool1d,
          nn.AdaptiveAvgPool2d,
          nn.AdaptiveAvgPool3d,
      )
      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 15 for calling a global function with example usage: adaptive_avgpooling_factory(dim) and returns: types