code: def __init__(
      self, dim, key_dim, num_heads, attn_ratio=4, activation=None
  ):
      super().__init__()
  
      self.num_heads = num_heads
      self.scale = key_dim**-0.5
      self.key_dim = key_dim
      self.nh_kd = key_dim * num_heads  # num_head key_dim
      self.d = int(attn_ratio * key_dim)
      self.dh = int(attn_ratio * key_dim) * num_heads
      self.attn_ratio = attn_ratio
  
      self.to_q = layers.ConvBN(dim, self.nh_kd, 1, bias_attr=False)
      self.to_k = layers.ConvBN(dim, self.nh_kd, 1, bias_attr=False)
      self.to_v = layers.ConvBN(dim, self.dh, 1, bias_attr=False)
  
      self.proj = nn.Sequential(
          activation(), layers.ConvBN(self.dh, dim, 1, bias_attr=False)
      )
      self.proj_encode_row = nn.Sequential(
          activation(),
          layers.ConvBN(self.dh, self.dh, 1, bias_attr=False),
      )
      self.pos_emb_rowq = SqueezeAxialPositionalEmbedding(
          self.nh_kd, 16
      )
      self.pos_emb_rowk = SqueezeAxialPositionalEmbedding(
          self.nh_kd, 16
      )
      self.proj_encode_column = nn.Sequential(
          activation(),
          layers.ConvBN(self.dh, self.dh, 1, bias_attr=False),
      )
      self.pos_emb_columnq = SqueezeAxialPositionalEmbedding(
          self.nh_kd, 16
      )
      self.pos_emb_columnk = SqueezeAxialPositionalEmbedding(
          self.nh_kd, 16
      )
  
      self.dwconv = layers.ConvBN(
          2 * self.dh,
          2 * self.dh,
          3,
          stride=1,
          padding=1,
          dilation=1,
          groups=2 * self.dh,
          bias_attr=False,
      )
      self.act = activation()
  
      self.pwconv = layers.ConvBN(2 * self.dh, dim, 1, bias_attr=False)
      self.sigmoid = nn.Hardsigmoid()
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddleseg.cvlibs import manager, param_init
  from paddleseg.models import layers
  from paddleseg.models.backbones.transformer_utils import DropPath, zeros_, ones_
  from paddleseg.utils import utils
label_desc: Use image node_id 1 to create a new SeaAttention object from inherited base classes: nn with example: obj = SeaAttention(dim, key_dim, num_heads, attn_ratio, activation)