code: def __init__(
      self,
      layers,
      in_chans=3,
      num_classes=1000,
      width_factor=1.0,
      v2=False,
      global_pool="fast",
      drop_rate=0.0,
      drop_path_rate=0.0,
  ):
      self.num_classes = num_classes
      self.drop_rate = drop_rate
      self.grad_checkpointing = False
      super(TResNet, self).__init__()
  
      aa_layer = BlurPool2d
      act_layer = nn.LeakyReLU
  
      # TResnet stages
      self.inplanes = int(64 * width_factor)
      self.planes = int(64 * width_factor)
      if v2:
          self.inplanes = self.inplanes // 8 * 8
          self.planes = self.planes // 8 * 8
  
      dpr = [
          x.tolist()
          for x in torch.linspace(0, drop_path_rate, sum(layers)).split(
              layers
          )
      ]
      conv1 = ConvNormAct(
          in_chans * 16,
          self.planes,
          stride=1,
          kernel_size=3,
          act_layer=act_layer,
      )
      layer1 = self._make_layer(
          Bottleneck if v2 else BasicBlock,
          self.planes,
          layers[0],
          stride=1,
          use_se=True,
          aa_layer=aa_layer,
          drop_path_rate=dpr[0],
      )
      layer2 = self._make_layer(
          Bottleneck if v2 else BasicBlock,
          self.planes * 2,
          layers[1],
          stride=2,
          use_se=True,
          aa_layer=aa_layer,
          drop_path_rate=dpr[1],
      )
      layer3 = self._make_layer(
          Bottleneck,
          self.planes * 4,
          layers[2],
          stride=2,
          use_se=True,
          aa_layer=aa_layer,
          drop_path_rate=dpr[2],
      )
      layer4 = self._make_layer(
          Bottleneck,
          self.planes * 8,
          layers[3],
          stride=2,
          use_se=False,
          aa_layer=aa_layer,
          drop_path_rate=dpr[3],
      )
  
      # body
      self.body = nn.Sequential(
          OrderedDict(
              [
                  ("s2d", SpaceToDepth()),
                  ("conv1", conv1),
                  ("layer1", layer1),
                  ("layer2", layer2),
                  ("layer3", layer3),
                  ("layer4", layer4),
              ]
          )
      )
  
      self.feature_info = [
          dict(
              num_chs=self.planes, reduction=2, module=""
          ),  # Not with S2D?
          dict(
              num_chs=self.planes * (Bottleneck.expansion if v2 else 1),
              reduction=4,
              module="body.layer1",
          ),
          dict(
              num_chs=self.planes
              * 2
              * (Bottleneck.expansion if v2 else 1),
              reduction=8,
              module="body.layer2",
          ),
          dict(
              num_chs=self.planes * 4 * Bottleneck.expansion,
              reduction=16,
              module="body.layer3",
          ),
          dict(
              num_chs=self.planes * 8 * Bottleneck.expansion,
              reduction=32,
              module="body.layer4",
          ),
      ]
  
      # head
      self.num_features = (self.planes * 8) * Bottleneck.expansion
      self.head = ClassifierHead(
          self.num_features,
          num_classes,
          pool_type=global_pool,
          drop_rate=drop_rate,
      )
  
      # model initialization
      for m in self.modules():
          if isinstance(m, nn.Conv2d):
              nn.init.kaiming_normal_(
                  m.weight, mode="fan_out", nonlinearity="leaky_relu"
              )
          if isinstance(m, nn.Linear):
              m.weight.data.normal_(0, 0.01)
  
      # residual connections special initialization
      for m in self.modules():
          if isinstance(m, BasicBlock):
              nn.init.zeros_(m.conv2.bn.weight)
          if isinstance(m, Bottleneck):
              nn.init.zeros_(m.conv3.bn.weight)
  
imports: from collections import OrderedDict
  from functools import partial
  import torch
  import torch.nn
  from timm.layers import SpaceToDepth, BlurPool2d, ClassifierHead, SEModule, ConvNormActAa, ConvNormAct, DropPath
  from ._builder import build_model_with_cfg
  from ._manipulate import checkpoint_seq
  from ._registry import register_model, generate_default_cfgs, register_model_deprecations
label_desc: Use image node_id 1 to create a new TResNet object from inherited base classes: nn with example: obj = TResNet(layers, in_chans, num_classes, width_factor, v2, global_pool, drop_rate, drop_path_rate)