code: def __init__(
      self,
      block_fn,
      ch_in,
      ch_out,
      n,
      act="swish",
      spp=False,
      use_alpha=False,
  ):
      super(CSPStage, self).__init__()
  
      ch_mid = int(ch_out // 2)
      self.conv1 = ConvBNLayer(ch_in, ch_mid, 1, act=act)
      self.conv2 = ConvBNLayer(ch_in, ch_mid, 1, act=act)
      self.convs = nn.Sequential()
      next_ch_in = ch_mid
      for i in range(n):
          self.convs.add_sublayer(
              str(i),
              eval(block_fn)(
                  next_ch_in,
                  ch_mid,
                  act=act,
                  shortcut=False,
                  use_alpha=use_alpha,
              ),
          )
          if i == (n - 1) // 2 and spp:
              self.convs.add_sublayer(
                  "spp", SPP(ch_mid * 4, ch_mid, 1, [5, 9, 13], act=act)
              )
          next_ch_in = ch_mid
      self.conv3 = ConvBNLayer(ch_mid * 2, ch_out, 1, act=act)
  
imports: import math
  import copy
  import numpy
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ppdet.core.workspace import register, serializable
  from ppdet.modeling.layers import DropBlock, MultiHeadAttention
  from ppdet.modeling.ops import get_act_fn
  from ..backbones.cspresnet import ConvBNLayer, BasicBlock
  from ..shape_spec import ShapeSpec
  from ..initializer import linear_init_
label_desc: Use image node_id 1 to create a new CSPStage object from inherited base classes: nn with example: obj = CSPStage(block_fn, ch_in, ch_out, n, act, spp, use_alpha)