class_docstr: Bottleneck transformation: 1x1, 3x3 [+SE], 1x1.
class_docstr_tok: ["Bottleneck","transformation",":","1x1",",","3x3","[","+SE","]",",","1x1","."]
code: def __init__(
      self,
      width_in: int,
      width_out: int,
      stride: int,
      bn_epsilon: float,
      bn_momentum: float,
      activation: nn.Module,
      group_width: int,
      bottleneck_multiplier: float,
      se_ratio: Optional[float],
  ):
      super().__init__()
      w_b = int(round(width_out * bottleneck_multiplier))
      g = w_b // group_width
  
      self.a = nn.Sequential(
          nn.Conv2d(width_in, w_b, 1, stride=1, padding=0, bias=False),
          nn.BatchNorm2d(w_b, eps=bn_epsilon, momentum=bn_momentum),
          activation,
      )
  
      self.b = nn.Sequential(
          nn.Conv2d(
              w_b,
              w_b,
              3,
              stride=stride,
              padding=1,
              groups=g,
              bias=False,
          ),
          nn.BatchNorm2d(w_b, eps=bn_epsilon, momentum=bn_momentum),
          activation,
      )
  
      if se_ratio:
          # The SE reduction ratio is defined with respect to the
          # beginning of the block
          width_se_out = int(round(se_ratio * width_in))
          self.se = SqueezeAndExcitationLayer(
              in_planes=w_b,
              reduction_ratio=None,
              reduced_planes=width_se_out,
              activation=activation,
          )
  
      self.c = nn.Conv2d(
          w_b, width_out, 1, stride=1, padding=0, bias=False
      )
      self.final_bn = nn.BatchNorm2d(
          width_out, eps=bn_epsilon, momentum=bn_momentum
      )
      self.depth = 3 if not se_ratio else 4
  
imports: import math
  from collections import OrderedDict
  from enum import auto, Enum
  from typing import Any, Dict, Optional, Sequence
  import torch.nn
  from classy_vision.generic.util import get_torch_version
  from classy_vision.models import ClassyModel, register_model
  from classy_vision.models.squeeze_and_excitation_layer import SqueezeAndExcitationLayer
label_desc: Use image node_id 1 to create a new BottleneckTransform object from inherited base classes: nn with example: obj = BottleneckTransform(width_in, width_out, stride, bn_epsilon, bn_momentum, activation, group_width, bottleneck_multiplier, se_ratio)