code: def pad_image(img, mean, std, crop_size):
      b, c, h, w = img.size()
      if c != 3:
          raise AssertionError
      padh = crop_size - h if h < crop_size else 0
      padw = crop_size - w if w < crop_size else 0
      pad_values = -np.array(mean) / np.array(std)
      img_pad = img.new().resize_(b, c, h + padh, w + padw)
      for i in range(c):
          # note that pytorch pad params is in reversed orders
          img_pad[:, i, :, :] = F.pad(
              img[:, i, :, :], (0, padw, 0, padh), value=pad_values[i]
          )
      if not (
          img_pad.size(2) >= crop_size and img_pad.size(3) >= crop_size
      ):
          raise AssertionError
      return img_pad
  
file_path: pywick/pywick/models/segmentation/testnets/tkcnet/base.py
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from .resnet import *
label_desc: Use image node_id 3 for calling a global function with example usage: pad_image(img, mean, std, crop_size) and returns: img_pad