code: def __init__(
      self,
      block_fn,
      ch_in,
      ch_out,
      n,
      stride,
      act="relu",
      attn="eca",
      use_alpha=False,
  ):
      super(CSPResStage, self).__init__()
  
      ch_mid = (ch_in + ch_out) // 2
      if stride == 2:
          self.conv_down = ConvBNLayer(
              ch_in, ch_mid, 3, stride=2, padding=1, act=act
          )
      else:
          self.conv_down = None
      self.conv1 = ConvBNLayer(ch_mid, ch_mid // 2, 1, act=act)
      self.conv2 = ConvBNLayer(ch_mid, ch_mid // 2, 1, act=act)
      self.blocks = nn.Sequential(
          *[
              block_fn(
                  ch_mid // 2,
                  ch_mid // 2,
                  act=act,
                  shortcut=True,
                  use_alpha=use_alpha,
              )
              for i in range(n)
          ]
      )
      if attn:
          self.attn = EffectiveSELayer(ch_mid, act="hardsigmoid")
      else:
          self.attn = None
  
      self.conv3 = ConvBNLayer(ch_mid, ch_out, 1, act=act)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from paddle.regularizer import L2Decay
  from paddle.nn.initializer import Constant
  from ppdet.modeling.ops import get_act_fn
  from ppdet.core.workspace import register, serializable
  from ..shape_spec import ShapeSpec
label_desc: Use image node_id 1 to create a new CSPResStage object from inherited base classes: nn with example: obj = CSPResStage(block_fn, ch_in, ch_out, n, stride, act, attn, use_alpha)