code: def __init__(self, inplanes, planes, stride=1):
      super().__init__()
  
      # all conv layers have stride 1. an avgpool is performed after the second convolution when stride > 1
      self.conv1 = nn.Conv2D(inplanes, planes, 1, bias_attr=False)
      self.bn1 = nn.BatchNorm2D(planes)
  
      self.conv2 = nn.Conv2D(
          planes, planes, 3, padding=1, bias_attr=False
      )
      self.bn2 = nn.BatchNorm2D(planes)
  
      self.avgpool = nn.AvgPool2D(stride) if stride > 1 else Identity()
  
      self.conv3 = nn.Conv2D(
          planes, planes * self.expansion, 1, bias_attr=False
      )
      self.bn3 = nn.BatchNorm2D(planes * self.expansion)
  
      self.relu = nn.ReLU()
      self.downsample = None
      self.stride = stride
  
      if stride > 1 or inplanes != planes * Bottleneck.expansion:
          self.downsample = nn.Sequential(
              ("-1", nn.AvgPool2D(stride)),
              (
                  "0",
                  nn.Conv2D(
                      inplanes,
                      planes * self.expansion,
                      1,
                      stride=1,
                      bias_attr=False,
                  ),
              ),
              ("1", nn.BatchNorm2D(planes * self.expansion)),
          )
  
imports: from typing import Optional
  import paddle
  import paddle.nn
  from paddle import Tensor
  from paddle.nn import functional
  from paddle.nn import Linear
label_desc: Use image node_id 1 to create a new Bottleneck object from inherited base classes: nn with example: obj = Bottleneck(inplanes, planes, stride)