text: import torch.nn as nn
  
  from ..registry import BACKBONES
  
  
  class _BatchNorm2d(nn.BatchNorm2d):
  
      def __init__(self, num_features, *args, **kwargs):
          super(_BatchNorm2d, self).__init__(
              num_features, *args, eps=1e-6, momentum=0.05, **kwargs)
  
  
  class _AlexNet(nn.Module):
  
      def forward(self, x):
          x = self.conv1(x)
          x = self.conv2(x)
          x = self.conv3(x)
          x = self.conv4(x)
          x = self.conv5(x)
          return x
  
      def init_weights(self):
          gain = 1
          for m in self.modules():
              if isinstance(m, nn.Conv2d):
                  nn.init.xavier_uniform_(m.weight, gain)
                  if m.bias is not None:
                      nn.init.constant_(m.bias, 0)
              elif isinstance(m, nn.BatchNorm2d):
                  nn.init.constant_(m.weight, 1)
                  nn.init.constant_(m.bias, 0)
              elif isinstance(m, nn.Linear):
                  nn.init.xavier_uniform_(m.weight, gain)
                  if m.bias is not None:
                      nn.init.constant_(m.bias, 0)
  
  
  @BACKBONES.register_module()
  class AlexNetV1(_AlexNet):
      output_stride = 8
  
      def __init__(self, **kwargs):
          super(AlexNetV1, self).__init__()
          self.conv1 = nn.Sequential(
              nn.Conv2d(3, 96, 11, 2), _BatchNorm2d(96), nn.ReLU(inplace=True),
              nn.MaxPool2d(3, 2))
          self.conv2 = nn.Sequential(
              nn.Conv2d(96, 256, 5, 1, groups=2), _BatchNorm2d(256),
              nn.ReLU(inplace=True), nn.MaxPool2d(3, 2))
          self.conv3 = nn.Sequential(
              nn.Conv2d(256, 384, 3, 1), _BatchNorm2d(384),
              nn.ReLU(inplace=True))
          self.conv4 = nn.Sequential(
              nn.Conv2d(384, 384, 3, 1, groups=2), _BatchNorm2d(384),
              nn.ReLU(inplace=True))
          self.conv5 = nn.Sequential(nn.Conv2d(384, 256, 3, 1, groups=2))
  
  
  @BACKBONES.register_module()
  class AlexNetV2(_AlexNet):
      output_stride = 4
  
      def __init__(self):
          super(AlexNetV2, self).__init__()
          self.conv1 = nn.Sequential(
              nn.Conv2d(3, 96, 11, 2), _BatchNorm2d(96), nn.ReLU(inplace=True),
              nn.MaxPool2d(3, 2))
          self.conv2 = nn.Sequential(
              nn.Conv2d(96, 256, 5, 1, groups=2), _BatchNorm2d(256),
              nn.ReLU(inplace=True), nn.MaxPool2d(3, 1))
          self.conv3 = nn.Sequential(
              nn.Conv2d(256, 384, 3, 1), _BatchNorm2d(384),
              nn.ReLU(inplace=True))
          self.conv4 = nn.Sequential(
              nn.Conv2d(384, 384, 3, 1, groups=2), _BatchNorm2d(384),
              nn.ReLU(inplace=True))
          self.conv5 = nn.Sequential(nn.Conv2d(384, 32, 3, 1, groups=2))
  
  
  @BACKBONES.register_module()
  class AlexNetV3(_AlexNet):
      output_stride = 8
  
      def __init__(self):
          super(AlexNetV3, self).__init__()
          self.conv1 = nn.Sequential(
              nn.Conv2d(3, 192, 11, 2), _BatchNorm2d(192), nn.ReLU(inplace=True),
              nn.MaxPool2d(3, 2))
          self.conv2 = nn.Sequential(
              nn.Conv2d(192, 512, 5, 1), _BatchNorm2d(512),
              nn.ReLU(inplace=True), nn.MaxPool2d(3, 2))
          self.conv3 = nn.Sequential(
              nn.Conv2d(512, 768, 3, 1), _BatchNorm2d(768),
              nn.ReLU(inplace=True))
          self.conv4 = nn.Sequential(
              nn.Conv2d(768, 768, 3, 1), _BatchNorm2d(768),
              nn.ReLU(inplace=True))
          self.conv5 = nn.Sequential(
              nn.Conv2d(768, 512, 3, 1), _BatchNorm2d(512))
  