class_docstr: Parent class for 2-layer (BasicLayer) and 3-layer (BottleneckLayer)
  bottleneck layer class
class_docstr_tok: ["Parent","class","for","2-layer","(","BasicLayer",")","and","3-layer","(","BottleneckLayer",")","bottleneck","layer","class"]
code: def forward(self, x):
      # if required, perform downsampling along shortcut connection:
      if self.downsample is None:
          residual = x
      else:
          residual = self.downsample(x)
  
      # forward pass through convolutional block:
      out = self.convolutional_block(x)
  
      if self.final_bn_relu:
          out = self.bn(out)
  
      if self.se is not None:
          out = self.se(out)
  
      # add residual connection, perform rely + batchnorm, and return result:
      out += residual
      if self.final_bn_relu:
          out = self.relu(out)
      return out
  
imports: import copy
  import math
  import re
  import warnings
  from collections import OrderedDict
  from typing import Any, Dict, Optional, Sequence
  import torch.nn
  from classy_vision.generic.util import is_pos_int, is_pos_int_tuple
  from .None import register_model
  from .classy_model import ClassyModel
  from .squeeze_and_excitation_layer import SqueezeAndExcitationLayer
label_desc: Use image node_id 2 for calling the GenericLayer obj's underlying member method code with example usage: obj.forward(x) and returns: out