gaussian_blur¶

torchvision.transforms.functional.
gaussian_blur
(img: torch.Tensor, kernel_size: List[int], sigma: Optional[List[float]] = None) → torch.Tensor[source]¶ 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 an arbitrary number of leading dimensions.
 Parameters
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.Note
In torchscript mode kernel_size as single int is not supported, use a sequence of length 1:
[ksize, ]
.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 usingkernel_size
assigma = 0.3 * ((kernel_size  1) * 0.5  1) + 0.8
. Default, None.Note
In torchscript mode sigma as single float is not supported, use a sequence of length 1:
[sigma, ]
.
 Returns
Gaussian Blurred version of the image.
 Return type
PIL Image or Tensor
Examples using
gaussian_blur
: