code: def sem_seg_postprocess(
      result, img_size, output_height, output_width
  ):
      """Return semantic segmentation predictions in the original resolution.
  
      The input images are often resized when entering semantic segmentor.
      Moreover, in same cases, they also padded inside segmentor to be
      divisible by maximum network stride. As a result, we often need
      the predictions of the segmentor in a different resolution from
      its inputs.
  
      Args:
          result (Tensor): semantic segmentation prediction logits.
              A tensor of shape (C, H, W), where C is the number of classes,
              and H, W are the height and width of the prediction.
          img_size (tuple): image size that segmentor is taking as input.
          output_height, output_width: the desired output resolution.
  
      Returns:
          semantic segmentation prediction (Tensor): A tensor of the shape
              (C, output_height, output_width) that contains per-pixel
              soft predictions.
      """
      result = result[:, : img_size[0], : img_size[1]].expand(
          1, -1, -1, -1
      )
      if is_lower_torch_version():
          result = F.interpolate(
              result,
              size=(output_height, output_width),
              mode="bicubic",
              align_corners=False,
          )[0]
      else:
          result = F.interpolate(
              result,
              size=(output_height, output_width),
              mode="bicubic",
              align_corners=False,
              antialias=True,
          )[0]
      return result
  
file_path: mmdetection/projects/XDecoder/xdecoder/utils.py
imports: import logging
  from contextlib import contextmanager
  from functools import wraps
  import torch
  from mmcv.cnn.bricks.wrappers import obsolete_torch_version
  from torch.nn import functional
label_desc: Use image node_id 4 for calling a global function with example usage: sem_seg_postprocess(result, img_size, output_height, output_width) and returns: result