class_docstr: The EABlock implementation based on PaddlePaddle.
  Args:
      in_channels (int, optional): The input channels.
      out_channels (int, optional): The output channels.
      num_heads (int, optional): The num of heads in attention. Default: 8
      drop_rate (float, optional): The drop rate in MLP. Default:0.
      drop_path_rate (float, optional): The drop path rate in EABlock. Default: 0.2
      use_injection (bool, optional): Whether inject the high feature into low feature. Default: True
      use_cross_kv (bool, optional): Wheter use cross_kv. Default: True
      cross_size (int, optional): The size of pooling in cross_kv. Default: 12
class_docstr_tok: ["The","EABlock","implementation","based","on","PaddlePaddle",".","Args",":","in_channels","(","int",",","optional",")",":","The","input","channels",".","out_channels","(","int",",","optional",")",":","The","output","channels",".","num_heads","(","int",",","optional",")",":","The","num","of","heads","in","attention",".","Default",":","8","drop_rate","(","float",",","optional",")",":","The","drop","rate","in","MLP",".","Default:0.","drop_path_rate","(","float",",","optional",")",":","The","drop","path","rate","in","EABlock",".","Default",":","0.2","use_injection","(","bool",",","optional",")",":","Whether","inject","the","high","feature","into","low","feature",".","Default",":","True","use_cross_kv","(","bool",",","optional",")",":","Wheter","use","cross_kv",".","Default",":","True","cross_size","(","int",",","optional",")",":","The","size","of","pooling","in","cross_kv",".","Default",":","12"]
code: def forward(self, x):
      x_h, x_l = x
  
      # low resolution
      x_l_res = self.attn_shortcut_l(x_l) if self.proj_flag else x_l
      x_l = x_l_res + self.drop_path(self.attn_l(x_l))
      x_l = x_l + self.drop_path(self.mlp_l(x_l))  # n,out_chs_l,h,w
  
      # compression
      x_h_shape = paddle.shape(x_h)[2:]
      x_l_cp = self.compression(x_l)
      x_h += F.interpolate(x_l_cp, size=x_h_shape, mode="bilinear")
  
      # high resolution
      if not self.use_cross_kv:
          x_h = x_h + self.drop_path(
              self.attn_h(x_h)
          )  # n,out_chs_h,h,w
      else:
          cross_kv = self.cross_kv(x_l)  # n,2*out_channels_h,12,12
          cross_k, cross_v = paddle.split(cross_kv, 2, axis=1)
          cross_k = cross_k.transpose([0, 2, 3, 1]).reshape(
              [-1, self.out_channels_h, 1, 1]
          )  # n*144,out_channels_h,1,1
          cross_v = cross_v.reshape(
              [-1, self.cross_size * self.cross_size, 1, 1]
          )  # n*out_channels_h,144,1,1
          x_h = x_h + self.drop_path(
              self.attn_h(x_h, cross_k, cross_v)
          )  # n,out_chs_h,h,w
  
      x_h = x_h + self.drop_path(self.mlp_h(x_h))
  
      # injection
      if self.use_injection:
          x_l = x_l + self.down(x_h)
  
      return x_h, x_l
  
imports: from functools import partial
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.models import layers
  from paddleseg.utils import utils
  from paddleseg.models.backbones.transformer_utils import DropPath, Identity
  from paddleseg.cvlibs.param_init import constant_init, kaiming_normal_init, trunc_normal_init
label_desc: Use image node_id 4 for calling the EABlock obj's underlying member method code with example usage: obj.forward(x) and returns: x_h,  x_l