code: def __init__(
      self,
      in_channels,
      scale_factor=2,
      width=128,
      height=32,
      STN=False,
      srb_nums=5,
      mask=False,
      hidden_units=32,
      infer_mode=False,
      **kwargs,
  ):
      super(TSRN, self).__init__()
      in_planes = 3
      if mask:
          in_planes = 4
      assert math.log(scale_factor, 2) % 1 == 0
      upsample_block_num = int(math.log(scale_factor, 2))
      self.block1 = nn.Sequential(
          nn.Conv2D(
              in_planes, 2 * hidden_units, kernel_size=9, padding=4
          ),
          nn.PReLU(),
      )
      self.srb_nums = srb_nums
      for i in range(srb_nums):
          setattr(
              self,
              "block%d" % (i + 2),
              RecurrentResidualBlock(2 * hidden_units),
          )
  
      setattr(
          self,
          "block%d" % (srb_nums + 2),
          nn.Sequential(
              nn.Conv2D(
                  2 * hidden_units,
                  2 * hidden_units,
                  kernel_size=3,
                  padding=1,
              ),
              nn.BatchNorm2D(2 * hidden_units),
          ),
      )
  
      block_ = [
          UpsampleBLock(2 * hidden_units, 2)
          for _ in range(upsample_block_num)
      ]
      block_.append(
          nn.Conv2D(
              2 * hidden_units, in_planes, kernel_size=9, padding=4
          )
      )
      setattr(self, "block%d" % (srb_nums + 3), nn.Sequential(*block_))
      self.tps_inputsize = [
          height // scale_factor,
          width // scale_factor,
      ]
      tps_outputsize = [height // scale_factor, width // scale_factor]
      num_control_points = 20
      tps_margins = [0.05, 0.05]
      self.stn = STN
      if self.stn:
          self.tps = TPSSpatialTransformer(
              output_image_size=tuple(tps_outputsize),
              num_control_points=num_control_points,
              margins=tuple(tps_margins),
          )
  
          self.stn_head = STN_model(
              in_channels=in_planes,
              num_ctrlpoints=num_control_points,
              activation="none",
          )
      self.out_channels = in_channels
  
      self.r34_transformer = Transformer()
      for param in self.r34_transformer.parameters():
          param.trainable = False
      self.infer_mode = infer_mode
  
imports: import math
  import paddle
  import paddle.nn.functional
  from paddle import nn
  from collections import OrderedDict
  import sys
  import numpy
  import warnings
  import math, copy
  import cv2
  from .tps_spatial_transformer import TPSSpatialTransformer
  from .stn import STN
  from ppocr.modeling.heads.sr_rensnet_transformer import Transformer
label_desc: Use image node_id 1 to create a new TSRN object from inherited base classes: nn with example: obj = TSRN(in_channels, scale_factor, width, height, STN, srb_nums, mask, hidden_units, infer_mode)