code: def avg_pool_nd(n: int, *args: Any, **kwargs: Any) -> Module:
      if n == 1:
          return nn.AvgPool1d(*args, **kwargs)
      elif n == 2:
          return nn.AvgPool2d(*args, **kwargs)
      elif n == 3:
          return nn.AvgPool3d(*args, **kwargs)
      raise ValueError(f"unsupported dimensions: {n}")
  
file_path: carefree-learn/cflearn/modules/blocks/utils.py
imports: import torch.nn
  from torch import Tensor
  from typing import Any
  from torch.nn import Module
label_desc: Use image node_id 2 for calling a global function with example usage: avg_pool_nd(n) and returns: nn, nn, nn