class_docstr: Only pad the image's width.
  
  Required Keys:
  
  - img
  
  Modified Keys:
  
  - img
  - img_shape
  
  Added Keys:
  
  - pad_shape
  - pad_fixed_size
  - pad_size_divisor
  - valid_ratio
  
  Args:
      width (int): Target width of padded image. Defaults to None.
      pad_cfg (dict): Config to construct the Resize transform. Refer to
          ``Pad`` for detail. Defaults to ``dict(type='Pad')``.
class_docstr_tok: ["Only","pad","the","image","'s","width",".","Required","Keys",":","-","img","Modified","Keys",":","-","img","-","img_shape","Added","Keys",":","-","pad_shape","-","pad_fixed_size","-","pad_size_divisor","-","valid_ratio","Args",":","width","(","int",")",":","Target","width","of","padded","image",".","Defaults","to","None",".","pad_cfg","(","dict",")",":","Config","to","construct","the","Resize","transform",".","Refer","to","``","Pad","``","for","detail",".","Defaults","to","``","dict","(","type='Pad","'",")","``","."]
code: def __init__(
      self, width: int, pad_cfg: dict = dict(type="Pad")
  ) -> None:
      super().__init__()
      assert isinstance(width, int)
      self.width = width
      self.pad_cfg = pad_cfg
      _pad_cfg = self.pad_cfg.copy()
      _pad_cfg.update(dict(size=0))
      self.pad = TRANSFORMS.build(_pad_cfg)
  
imports: import math
  import random
  from typing import Dict, List, Optional, Tuple
  import cv2
  import mmcv
  import numpy
  from mmcv.transforms.base import BaseTransform
  from mmcv.transforms.utils import cache_randomness
  from mmocr.registry import TRANSFORMS
label_desc: Use image node_id 1 to create a new PadToWidth object from inherited base classes: BaseTransform with example: obj = PadToWidth(width, pad_cfg)