code: def make_layers(
      cfg: List[Union[str, int]], batch_norm: bool = False
  ) -> nn.Sequential:
      layers: List[nn.Module] = []
      in_channels = 3
      for v in cfg:
          if v == "M":
              layers += [nn.MaxPool2d(kernel_size=2, stride=2)]
          else:
              v = cast(int, v)
              conv2d = nn.Conv2d(
                  in_channels, v, kernel_size=3, padding=1
              )
              if batch_norm:
                  layers += [
                      conv2d,
                      nn.BatchNorm2d(v),
                      nn.ReLU(inplace=True),
                  ]
              else:
                  layers += [conv2d, nn.ReLU(inplace=True)]
              in_channels = v
      return nn.Sequential(*layers)
  
imports: from functools import partial
  from typing import Any, cast, Dict, List, Optional, Union
  import torch
  import torch.nn
  from ..transforms._presets import ImageClassification
  from ..utils import _log_api_usage_once
  from ._api import register_model, Weights, WeightsEnum
  from ._meta import _IMAGENET_CATEGORIES
  from ._utils import _ovewrite_named_param, handle_legacy_interface
label_desc: Use image node_id 1 for calling a global function with example usage: make_layers(cfg, batch_norm) and returns: nn