- torchvision.transforms.functional.gaussian_blur(img: Tensor, kernel_size: List[int], sigma: Optional[List[float]] = None) Tensor ¶
Performs Gaussian blurring on the image by given kernel. If the image is torch Tensor, it is expected to have […, H, W] shape, where … means at most one leading dimension.
img (PIL Image or Tensor) – Image to be blurred
kernel_size (sequence of python:ints or int) –
Gaussian kernel size. Can be a sequence of integers like
(kx, ky)or a single integer for square kernels.
In torchscript mode kernel_size as single int is not supported, use a sequence of length 1:
sigma (sequence of python:floats or float, optional) –
Gaussian kernel standard deviation. Can be a sequence of floats like
(sigma_x, sigma_y)or a single float to define the same sigma in both X/Y directions. If None, then it is computed using
sigma = 0.3 * ((kernel_size - 1) * 0.5 - 1) + 0.8. Default, None.
In torchscript mode sigma as single float is not supported, use a sequence of length 1:
Gaussian Blurred version of the image.
- Return type:
PIL Image or Tensor
gaussian_blur:Illustration of transforms