class_docstr: EESP block, principle: reduce -> split -> transform -> merge
  
  Args:
      in_channels (int): Number of input channels.
      out_channels (int): Number of output channels.
      stride (int, optional): Factor by which we should skip (useful for down-sampling). If 2, then down-samples the feature map by 2. Default: 1.
      branches (int, optional): Number of branches. Default: 4.
      kernel_size_maximum (int, optional): A maximum value of receptive field allowed for EESP block. Default: 7.
      down_method (str, optional): Down sample or not, only support 'avg' and 'esp'(equivalent to stride is 2 or not). Default: 'esp'.
class_docstr_tok: ["EESP","block",",","principle",":","reduce","-",">","split","-",">","transform","-",">","merge","Args",":","in_channels","(","int",")",":","Number","of","input","channels",".","out_channels","(","int",")",":","Number","of","output","channels",".","stride","(","int",",","optional",")",":","Factor","by","which","we","should","skip","(","useful","for","down-sampling",")",".","If","2",",","then","down-samples","the","feature","map","by","2",".","Default",":","1.","branches","(","int",",","optional",")",":","Number","of","branches",".","Default",":","4.","kernel_size_maximum","(","int",",","optional",")",":","A","maximum","value","of","receptive","field","allowed","for","EESP","block",".","Default",":","7.","down_method","(","str",",","optional",")",":","Down","sample","or","not",",","only","support","'avg","'","and","'esp","'","(","equivalent","to","stride","is","2","or","not",")",".","Default",":","'esp","'","."]
code: def __init__(
      self,
      in_channels,
      out_channels,
      stride=1,
      branches=4,
      kernel_size_maximum=7,
      down_method="esp",
  ):
      super(EESP, self).__init__()
      if out_channels % branches != 0:
          raise RuntimeError(
              "The out_channes for EESP should be factorized by branches, but out_channels={} cann't be factorized by branches={}".format(
                  out_channels, branches
              )
          )
      assert down_method in [
          "avg",
          "esp",
      ], "The down_method for EESP only support 'avg' or 'esp', but got down_method={}".format(
          down_method
      )
      self.in_channels = in_channels
      self.stride = stride
  
      in_branch_channels = int(out_channels / branches)
      self.group_conv_in = layers.ConvBNPReLU(
          in_channels,
          in_branch_channels,
          1,
          stride=1,
          groups=branches,
          bias_attr=False,
      )
  
      map_ksize_dilation = {
          3: 1,
          5: 2,
          7: 3,
          9: 4,
          11: 5,
          13: 6,
          15: 7,
          17: 8,
      }
      self.kernel_sizes = []
      for i in range(branches):
          kernel_size = 3 + 2 * i
          kernel_size = (
              kernel_size if kernel_size <= kernel_size_maximum else 3
          )
          self.kernel_sizes.append(kernel_size)
      self.kernel_sizes.sort()
  
      self.spp_modules = nn.LayerList()
      for i in range(branches):
          dilation = map_ksize_dilation[self.kernel_sizes[i]]
          self.spp_modules.append(
              nn.Conv2D(
                  in_branch_channels,
                  in_branch_channels,
                  kernel_size=3,
                  padding="same",
                  stride=stride,
                  dilation=dilation,
                  groups=in_branch_channels,
                  bias_attr=False,
              )
          )
      self.group_conv_out = layers.ConvBN(
          out_channels,
          out_channels,
          kernel_size=1,
          stride=1,
          groups=branches,
          bias_attr=False,
      )
      self.bn_act = BNPReLU(out_channels)
      self._act = nn.PReLU()
      self.down_method = True if down_method == "avg" else False
  
imports: import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg import utils
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.models import layers
label_desc: Use image node_id 1 to create a new EESP object from inherited base classes: nn with example: obj = EESP(in_channels, out_channels, stride, branches, kernel_size_maximum, down_method)