class_docstr: Res2Net/Res2NeXT DLA Bottleneck
  Adapted from https://github.com/gasvn/Res2Net/blob/master/dla.py
class_docstr_tok: ["Res2Net\/Res2NeXT","DLA","Bottleneck","Adapted","from","https",":","\/\/github.com\/gasvn\/Res2Net\/blob\/master\/dla.py"]
code: def __init__(
      self,
      inplanes,
      outplanes,
      stride=1,
      dilation=1,
      scale=4,
      cardinality=8,
      base_width=4,
  ):
      super(DlaBottle2neck, self).__init__()
      self.is_first = stride > 1
      self.scale = scale
      mid_planes = int(
          math.floor(outplanes * (base_width / 64)) * cardinality
      )
      mid_planes = mid_planes // self.expansion
      self.width = mid_planes
  
      self.conv1 = nn.Conv2d(
          inplanes, mid_planes * scale, kernel_size=1, bias=False
      )
      self.bn1 = nn.BatchNorm2d(mid_planes * scale)
  
      num_scale_convs = max(1, scale - 1)
      convs = []
      bns = []
      for _ in range(num_scale_convs):
          convs.append(
              nn.Conv2d(
                  mid_planes,
                  mid_planes,
                  kernel_size=3,
                  stride=stride,
                  padding=dilation,
                  dilation=dilation,
                  groups=cardinality,
                  bias=False,
              )
          )
          bns.append(nn.BatchNorm2d(mid_planes))
      self.convs = nn.ModuleList(convs)
      self.bns = nn.ModuleList(bns)
      self.pool = (
          nn.AvgPool2d(kernel_size=3, stride=stride, padding=1)
          if self.is_first
          else None
      )
  
      self.conv3 = nn.Conv2d(
          mid_planes * scale, outplanes, kernel_size=1, bias=False
      )
      self.bn3 = nn.BatchNorm2d(outplanes)
      self.relu = nn.ReLU(inplace=True)
  
imports: import math
  from typing import List, Optional
  import torch
  import torch.nn
  import torch.nn.functional
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import create_classifier
  from ._builder import build_model_with_cfg
  from ._registry import register_model, generate_default_cfgs
label_desc: Use image node_id 1 to create a new DlaBottle2neck object from inherited base classes: nn with example: obj = DlaBottle2neck(inplanes, outplanes, stride, dilation, scale, cardinality, base_width)