code: def downsample_avg(
      in_channels,
      out_channels,
      kernel_size,
      stride=1,
      dilation=1,
      first_dilation=None,
      norm_layer=None,
  ):
      norm_layer = norm_layer or nn.BatchNorm2d
      avg_stride = stride if dilation == 1 else 1
      if stride == 1 and dilation == 1:
          pool = nn.Identity()
      else:
          avg_pool_fn = (
              AvgPool2dSame
              if avg_stride == 1 and dilation > 1
              else nn.AvgPool2d
          )
          pool = avg_pool_fn(
              2, avg_stride, ceil_mode=True, count_include_pad=False
          )
  
      return nn.Sequential(
          *[
              pool,
              nn.Conv2d(
                  in_channels,
                  out_channels,
                  1,
                  stride=1,
                  padding=0,
                  bias=False,
              ),
              norm_layer(out_channels),
          ]
      )
  
imports: import math
  from functools import partial
  import torch
  import torch.nn
  import torch.nn.functional
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.models.helpers import build_model_with_cfg
  from timm.models.layers import DropBlock2d, DropPath, AvgPool2dSame, BlurPool2d, GroupNorm, create_attn, get_attn, create_classifier
label_desc: Use image node_id 4 for calling a global function with example usage: downsample_avg(in_channels, out_channels, kernel_size, stride, dilation, first_dilation, norm_layer) and returns: nn