code: def __init__(
      self,
      in_channels,
      dims=64,  # XS
      depth=2,
      hidden_dims=120,
      use_guide=False,
      num_heads=8,
      qkv_bias=True,
      mlp_ratio=2.0,
      drop_rate=0.1,
      attn_drop_rate=0.1,
      drop_path=0.0,
      kernel_size=[3, 3],
      qk_scale=None,
  ):
      super(EncoderWithSVTR, self).__init__()
      self.depth = depth
      self.use_guide = use_guide
      self.conv1 = ConvBNLayer(
          in_channels,
          in_channels // 8,
          kernel_size=kernel_size,
          padding=[kernel_size[0] // 2, kernel_size[1] // 2],
          act=nn.Swish,
      )
      self.conv2 = ConvBNLayer(
          in_channels // 8, hidden_dims, kernel_size=1, act=nn.Swish
      )
  
      self.svtr_block = nn.LayerList(
          [
              Block(
                  dim=hidden_dims,
                  num_heads=num_heads,
                  mixer="Global",
                  HW=None,
                  mlp_ratio=mlp_ratio,
                  qkv_bias=qkv_bias,
                  qk_scale=qk_scale,
                  drop=drop_rate,
                  act_layer=nn.Swish,
                  attn_drop=attn_drop_rate,
                  drop_path=drop_path,
                  norm_layer="nn.LayerNorm",
                  epsilon=1e-05,
                  prenorm=False,
              )
              for i in range(depth)
          ]
      )
      self.norm = nn.LayerNorm(hidden_dims, epsilon=1e-6)
      self.conv3 = ConvBNLayer(
          hidden_dims, in_channels, kernel_size=1, act=nn.Swish
      )
      # last conv-nxn, the input is concat of input tensor and conv3 output tensor
      self.conv4 = ConvBNLayer(
          2 * in_channels,
          in_channels // 8,
          kernel_size=kernel_size,
          padding=[kernel_size[0] // 2, kernel_size[1] // 2],
          act=nn.Swish,
      )
  
      self.conv1x1 = ConvBNLayer(
          in_channels // 8, dims, kernel_size=1, act=nn.Swish
      )
      self.out_channels = dims
      self.apply(self._init_weights)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import paddle
  from paddle import nn
  from ppocr.modeling.heads.rec_ctc_head import get_para_bias_attr
  from ppocr.modeling.backbones.rec_svtrnet import Block, ConvBNLayer, trunc_normal_, zeros_, ones_
label_desc: Use image node_id 1 to create a new EncoderWithSVTR object from inherited base classes: nn with example: obj = EncoderWithSVTR(in_channels, dims, depth, hidden_dims, use_guide, num_heads, qkv_bias, mlp_ratio, drop_rate, attn_drop_rate, drop_path, kernel_size, qk_scale)