class_docstr: A PyTorch implementation of `SVTR: Scene Text Recognition with a Single
  Visual Model <https://arxiv.org/abs/2205.00159>`_
  
  Code is partially modified from https://github.com/PaddlePaddle/PaddleOCR.
  
  Args:
      img_size (Tuple[int, int], optional): The expected input image shape.
          Defaults to [32, 100].
      in_channels (int, optional): The num of input channels. Defaults to 3.
      embed_dims (Tuple[int, int, int], optional): Number of input channels.
          Defaults to [64, 128, 256].
      depth (Tuple[int, int, int], optional):
          The number of MixingBlock at each stage. Defaults to [3, 6, 3].
      num_heads (Tuple[int, int, int], optional): Number of attention heads.
          Defaults to [2, 4, 8].
      mixer_types (Tuple[str], optional): Mixing type in a MixingBlock.
          Defaults to ['Local']*6+['Global']*6.
      window_size (Tuple[Tuple[int, int]], optional):
          The height and width of the window at eeach stage.
          Defaults to [[7, 11], [7, 11], [7, 11]].
      merging_types (str, optional): The way of downsample in MergingBlock.
          Defaults to 'Conv'.
      mlp_ratio (int, optional): Ratio of hidden features to input in MLP.
          Defaults to 4.
      qkv_bias (bool, optional):
          Whether to add bias for qkv in attention modules. Defaults to True.
      qk_scale (float, optional): A scaling factor. Defaults to None.
      drop_rate (float, optional): Probability of an element to be zeroed.
          Defaults to 0.0.
      last_drop (float, optional): cfg of dropout at last stage.
          Defaults to 0.1.
      attn_drop_rate (float, optional): _description_. Defaults to 0..
      drop_path_rate (float, optional): stochastic depth rate.
          Defaults to 0.1.
      out_channels (int, optional): The num of output channels in backone.
          Defaults to 192.
      max_seq_len (int, optional): Maximum output sequence length :math:`T`.
          Defaults to 25.
      num_layers (int, optional): The num of conv in PatchEmbedding.
          Defaults to 2.
      prenorm (bool, optional): Whether to place the MixingBlock before norm.
          Defaults to True.
      init_cfg (dict or list[dict], optional): Initialization configs.
          Defaults to None.
class_docstr_tok: ["A","PyTorch","implementation","of","`","SVTR",":","Scene","Text","Recognition","with","a","Single","Visual","Model","<","https",":","\/\/arxiv.org\/abs\/2205.00159",">","`","_","Code","is","partially","modified","from","https",":","\/\/github.com\/PaddlePaddle\/PaddleOCR",".","Args",":","img_size","(","Tuple","[","int",",","int","]",",","optional",")",":","The","expected","input","image","shape",".","Defaults","to","[","32",",","100","]",".","in_channels","(","int",",","optional",")",":","The","num","of","input","channels",".","Defaults","to","3.","embed_dims","(","Tuple","[","int",",","int",",","int","]",",","optional",")",":","Number","of","input","channels",".","Defaults","to","[","64",",","128",",","256","]",".","depth","(","Tuple","[","int",",","int",",","int","]",",","optional",")",":","The","number","of","MixingBlock","at","each","stage",".","Defaults","to","[","3",",","6",",","3","]",".","num_heads","(","Tuple","[","int",",","int",",","int","]",",","optional",")",":","Number","of","attention","heads",".","Defaults","to","[","2",",","4",",","8","]",".","mixer_types","(","Tuple","[","str","]",",","optional",")",":","Mixing","type","in","a","MixingBlock",".","Defaults","to","[","'Local","'","]","*","6+","[","'Global","'","]","*","6.","window_size","(","Tuple","[","Tuple","[","int",",","int","]","]",",","optional",")",":","The","height","and","width","of","the","window","at","eeach","stage",".","Defaults","to","[","[","7",",","11","]",",","[","7",",","11","]",",","[","7",",","11","]","]",".","merging_types","(","str",",","optional",")",":","The","way","of","downsample","in","MergingBlock",".","Defaults","to","'Conv","'",".","mlp_ratio","(","int",",","optional",")",":","Ratio","of","hidden","features","to","input","in","MLP",".","Defaults","to","4.","qkv_bias","(","bool",",","optional",")",":","Whether","to","add","bias","for","qkv","in","attention","modules",".","Defaults","to","True",".","qk_scale","(","float",",","optional",")",":","A","scaling","factor",".","Defaults","to","None",".","drop_rate","(","float",",","optional",")",":","Probability","of","an","element","to","be","zeroed",".","Defaults","to","0.0.","last_drop","(","float",",","optional",")",":","cfg","of","dropout","at","last","stage",".","Defaults","to","0.1.","attn_drop_rate","(","float",",","optional",")",":","_description_",".","Defaults","to","0","..","drop_path_rate","(","float",",","optional",")",":","stochastic","depth","rate",".","Defaults","to","0.1.","out_channels","(","int",",","optional",")",":","The","num","of","output","channels","in","backone",".","Defaults","to","192.","max_seq_len","(","int",",","optional",")",":","Maximum","output","sequence","length",":","math",":","`","T","`",".","Defaults","to","25.","num_layers","(","int",",","optional",")",":","The","num","of","conv","in","PatchEmbedding",".","Defaults","to","2.","prenorm","(","bool",",","optional",")",":","Whether","to","place","the","MixingBlock","before","norm",".","Defaults","to","True",".","init_cfg","(","dict","or","list","[","dict","]",",","optional",")",":","Initialization","configs",".","Defaults","to","None","."]
docstr: Forward function except the last combing operation.
  
  Args:
      x (torch.Tensor): A Tensor of shape :math:`(N, H, W, C)`.
  
  Returns:
      torch.Tensor: A Tensor of shape :math:`(N, H/16, W/4, 256)`.
docstr_tok: ["Forward","function","except","the","last","combing","operation",".","Args",":","x","(","torch.Tensor",")",":","A","Tensor","of","shape",":","math",":","`","(","N",",","H",",","W",",","C",")","`",".","Returns",":","torch.Tensor",":","A","Tensor","of","shape",":","math",":","`","(","N",",","H\/16",",","W\/4",",","256",")","`","."]
code: def forward_features(self, x: torch.Tensor) -> torch.Tensor:
      """Forward function except the last combing operation.
  
      Args:
          x (torch.Tensor): A Tensor of shape :math:`(N, H, W, C)`.
  
      Returns:
          torch.Tensor: A Tensor of shape :math:`(N, H/16, W/4, 256)`.
      """
      x = self.patch_embed(x)
      x = x + self.absolute_pos_embed
      x = self.pos_drop(x)
      for blk in self.blocks1:
          x = blk(x)
      x = self.downsample1(
          x.permute(0, 2, 1).reshape(
              [
                  -1,
                  self.embed_dims[0],
                  self.input_shape[0],
                  self.input_shape[1],
              ]
          )
      )
  
      for blk in self.blocks2:
          x = blk(x)
      x = self.downsample2(
          x.permute(0, 2, 1).reshape(
              [
                  -1,
                  self.embed_dims[1],
                  self.input_shape[0] // 2,
                  self.input_shape[1],
              ]
          )
      )
  
      for blk in self.blocks3:
          x = blk(x)
      if not self.prenorm:
          x = self.layer_norm(x)
      return x
  
imports: from typing import Dict, List, Optional, Tuple, Union
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule
  from mmcv.cnn.bricks import DropPath
  from mmengine.model import BaseModule
  from mmengine.model.weight_init import trunc_normal_init
  from mmocr.registry import MODELS
  from mmocr.structures import TextRecogDataSample
label_desc: Use image node_id 3 for calling the SVTREncoder obj's underlying member method code with example usage: obj.forward_features(x) and returns: x