code: def __init__(
      self,
      dim,
      num_heads,
      mlp_ratio=4.0,
      qkv_bias=False,
      drop_path=0.0,
      act_layer=nn.GELU,
      norm_layer=nn.LayerNorm,
      ffn=True,
      cpe_act=False,
  ):
      super().__init__()
  
      self.cpe1 = ConvPosEnc(dim=dim, k=3, act=cpe_act)
      self.ffn = ffn
      self.norm1 = norm_layer(dim)
      self.attn = ChannelAttention(
          dim, num_heads=num_heads, qkv_bias=qkv_bias
      )
      self.drop_path1 = (
          DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
      )
      self.cpe2 = ConvPosEnc(dim=dim, k=3, act=cpe_act)
  
      if self.ffn:
          self.norm2 = norm_layer(dim)
          self.mlp = Mlp(
              in_features=dim,
              hidden_features=int(dim * mlp_ratio),
              act_layer=act_layer,
          )
          self.drop_path2 = (
              DropPath(drop_path) if drop_path > 0.0 else nn.Identity()
          )
      else:
          self.norm2 = None
          self.mlp = None
          self.drop_path2 = None
  
imports: from functools import partial
  from typing import Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from torch import Tensor
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD
  from timm.layers import DropPath, to_2tuple, trunc_normal_, Mlp, LayerNorm2d, get_norm_layer, use_fused_attn
  from timm.layers import NormMlpClassifierHead, ClassifierHead
  from ._builder import build_model_with_cfg
  from ._features_fx import register_notrace_function
  from ._manipulate import checkpoint_seq
  from ._registry import generate_default_cfgs, register_model
label_desc: Use image node_id 1 to create a new ChannelBlock object from inherited base classes: nn with example: obj = ChannelBlock(dim, num_heads, mlp_ratio, qkv_bias, drop_path, act_layer, norm_layer, ffn, cpe_act)