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","'",")","``","."]
docstr: Call function to pad images.
  
  Args:
      results (dict): Result dict from loading pipeline.
  
  Returns:
      dict: Updated result dict.
docstr_tok: ["Call","function","to","pad","images",".","Args",":","results","(","dict",")",":","Result","dict","from","loading","pipeline",".","Returns",":","dict",":","Updated","result","dict","."]
code: def transform(self, results: Dict) -> Dict:
      """Call function to pad images.
  
      Args:
          results (dict): Result dict from loading pipeline.
  
      Returns:
          dict: Updated result dict.
      """
      ori_height, ori_width = results["img"].shape[:2]
      valid_ratio = min(1.0, 1.0 * ori_width / self.width)
      size = (self.width, ori_height)
      self.pad.size = size
      results = self.pad(results)
      results["valid_ratio"] = valid_ratio
      return results
  
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 2 for calling the PadToWidth obj's underlying member method code with example usage: obj.transform(results) and returns: results