class_docstr: BasicBneck
class_docstr_tok: ["BasicBneck"]
code: def __init__(
      self,
      cfg: "CfgNode",
      causal: bool,
      tf_like: bool,
      conv_type: str,
      norm_layer: Optional[Callable[..., nn.Module]] = None,
      activation_layer: Optional[Callable[..., nn.Module]] = None,
  ) -> None:
      super().__init__()
      assert isinstance(cfg.stride, tuple) is True
      if (
          not cfg.stride[0] == 1
          or not 1 <= cfg.stride[1] <= 2
          or not 1 <= cfg.stride[2] <= 2
      ):
          raise ValueError("illegal stride value")
      self.res = None
  
      layers = []
      if cfg.expanded_channels != cfg.out_channels:
          # expand
          self.expand = ConvBlock3D(
              in_planes=cfg.input_channels,
              out_planes=cfg.expanded_channels,
              kernel_size=(1, 1, 1),
              padding=(0, 0, 0),
              causal=causal,
              conv_type=conv_type,
              tf_like=tf_like,
              norm_layer=norm_layer,
              activation_layer=activation_layer,
          )
      # deepwise
      self.deep = ConvBlock3D(
          in_planes=cfg.expanded_channels,
          out_planes=cfg.expanded_channels,
          kernel_size=cfg.kernel_size,
          padding=cfg.padding,
          stride=cfg.stride,
          groups=cfg.expanded_channels,
          causal=causal,
          conv_type=conv_type,
          tf_like=tf_like,
          norm_layer=norm_layer,
          activation_layer=activation_layer,
      )
      # SE
      self.se = SqueezeExcitation(
          cfg.expanded_channels,
          causal=causal,
          activation_1=activation_layer,
          activation_2=(
              nn.Sigmoid if conv_type == "3d" else HardSigmoid
          ),
          conv_type=conv_type,
      )
      # project
      self.project = ConvBlock3D(
          cfg.expanded_channels,
          cfg.out_channels,
          kernel_size=(1, 1, 1),
          padding=(0, 0, 0),
          causal=causal,
          conv_type=conv_type,
          tf_like=tf_like,
          norm_layer=norm_layer,
          activation_layer=nn.Identity,
      )
  
      if not (
          cfg.stride == (1, 1, 1)
          and cfg.input_channels == cfg.out_channels
      ):
          if cfg.stride != (1, 1, 1):
              if tf_like:
                  layers.append(TfAvgPool3D())
              else:
                  layers.append(
                      nn.AvgPool3d(
                          (1, 3, 3),
                          stride=cfg.stride,
                          padding=cfg.padding_avg,
                      )
                  )
          layers.append(
              ConvBlock3D(
                  in_planes=cfg.input_channels,
                  out_planes=cfg.out_channels,
                  kernel_size=(1, 1, 1),
                  padding=(0, 0, 0),
                  norm_layer=norm_layer,
                  activation_layer=nn.Identity,
                  causal=causal,
                  conv_type=conv_type,
                  tf_like=tf_like,
              )
          )
          self.res = nn.Sequential(*layers)
      # ReZero
      self.alpha = nn.Parameter(torch.tensor(0.0), requires_grad=True)
  
imports: from typing import Any, Callable, Optional, Tuple, Union
  from einops import rearrange
  import torch
  from torch.nn.modules.utils import _triple
  import torch.nn.functional
  from torch import nn, Tensor
  from towhee.models.utils.general_utils import make_divisible
  from towhee.models.utils.causal_module import CausalModule
  from towhee.models.layers.activations import HardSigmoid
  from towhee.models.layers.conv_bn_activation import Conv2dBNActivation, Conv3DBNActivation
  from towhee.models.layers.padding_functions import same_padding
  from towhee.models.layers.tf_avgpool3d import TfAvgPool3D
  from towhee.models.layers.temporal_cg_avgpool3d import TemporalCGAvgPool3D
label_desc: Use image node_id 1 to create a new BasicBneck object from inherited base classes: nn with example: obj = BasicBneck(cfg, causal, tf_like, conv_type, norm_layer, activation_layer)