pad

dnois.utils.pad(image: Tensor, padding: int | tuple[int, int], mode: str = 'constant', value: float = 0) Tensor

Pad an image with given padding width.

Parameters:
  • image (Tensor) – The image to be padded.

  • padding (int | tuple[int, int]) – Padding width in vertical and horizontal direction.

  • mode (str) – See torch.nn.functional.pad().

  • value (float) – See torch.nn.functional.pad().

Returns:

Padded image.

Return type:

Tensor