class_docstr: A classic ResNet's bottleneck layer composed by three `3x3` convolutions.
  
  The first `1x1` convolution reduces the input by a factor of `reduction` in order to make the second `3x3`
  convolution faster. The last `1x1` convolution remaps the reduced features to `out_channels`. If
  `downsample_in_bottleneck` is true, downsample will be in the first layer instead of the second layer.
class_docstr_tok: ["A","classic","ResNet","'s","bottleneck","layer","composed","by","three","`","3x3","`","convolutions",".","The","first","`","1x1","`","convolution","reduces","the","input","by","a","factor","of","`","reduction","`","in","order","to","make","the","second","`","3x3","`","convolution","faster",".","The","last","`","1x1","`","convolution","remaps","the","reduced","features","to","`","out_channels","`",".","If","`","downsample_in_bottleneck","`","is","true",",","downsample","will","be","in","the","first","layer","instead","of","the","second","layer","."]
code: def __init__(
      self,
      in_channels: int,
      out_channels: int,
      stride: int = 1,
      activation: str = "relu",
      reduction: int = 4,
      downsample_in_bottleneck: bool = False,
  ):
      super().__init__()
      should_apply_shortcut = in_channels != out_channels or stride != 1
      reduces_channels = out_channels // reduction
      self.shortcut = (
          ResNetShortCut(in_channels, out_channels, stride=stride)
          if should_apply_shortcut
          else nn.Identity()
      )
      self.layer = nn.Sequential(
          ResNetConvLayer(
              in_channels,
              reduces_channels,
              kernel_size=1,
              stride=stride if downsample_in_bottleneck else 1,
          ),
          ResNetConvLayer(
              reduces_channels,
              reduces_channels,
              stride=stride if not downsample_in_bottleneck else 1,
          ),
          ResNetConvLayer(
              reduces_channels,
              out_channels,
              kernel_size=1,
              activation=None,
          ),
      )
      self.activation = ACT2FN[activation]
  
imports: from typing import Optional
  import torch
  import torch.utils.checkpoint
  from torch import Tensor, nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...modeling_outputs import BackboneOutput, BaseModelOutputWithNoAttention, BaseModelOutputWithPoolingAndNoAttention, ImageClassifierOutputWithNoAttention
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_code_sample_docstrings, add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from ...utils.backbone_utils import BackboneMixin
  from .configuration_resnet import ResNetConfig
label_desc: Use image node_id 1 to create a new ResNetBottleNeckLayer object from inherited base classes: nn with example: obj = ResNetBottleNeckLayer(in_channels, out_channels, stride, activation, reduction, downsample_in_bottleneck)