code: def _make_layer(
      self,
      block: Type[Union[BasicBlock, Bottleneck]],
      planes: int,
      blocks: int,
      stride: int = 1,
      dilate: bool = False,
  ) -> nn.Sequential:
      norm_layer = self._norm_layer
      downsample = None
      previous_dilation = self.dilation
      if dilate:
          self.dilation *= stride
          stride = 1
      if stride != 1 or self.inplanes != planes * block.expansion:
          downsample = nn.Sequential(
              conv1x1(self.inplanes, planes * block.expansion, stride),
              norm_layer(planes * block.expansion),
          )
  
      layers = []
      layers.append(
          block(
              self.inplanes,
              planes,
              stride,
              downsample,
              self.groups,
              self.base_width,
              previous_dilation,
              norm_layer,
          )
      )
      self.inplanes = planes * block.expansion
      for _ in range(1, blocks):
          layers.append(
              block(
                  self.inplanes,
                  planes,
                  groups=self.groups,
                  base_width=self.base_width,
                  dilation=self.dilation,
                  norm_layer=norm_layer,
              )
          )
  
      return nn.Sequential(*layers)
  
imports: from functools import partial
  from typing import Any, Callable, List, Optional, Type, Union
  import torch
  import torch.nn
  from torch import Tensor
  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 2 for calling the ResNet obj's underlying member method code with example usage: obj._make_layer(block, planes, blocks, stride, dilate) and returns: nn