GaussianBlur — Torchvision 0.22 documentation (original) (raw)

class torchvision.transforms.v2.GaussianBlur(kernel_size: Union[int, Sequence[int]], sigma: Union[int, float, Sequence[float]] = (0.1, 2.0))[source]

Blurs image with randomly chosen Gaussian blur kernel.

The convolution will be using reflection padding corresponding to the kernel size, to maintain the input shape.

If the input is a Tensor, it is expected to have […, C, H, W] shape, where … means an arbitrary number of leading dimensions.

Parameters:

Examples using GaussianBlur:

static get_params(sigma_min: float, sigma_max: float) → float[source]

Choose sigma for random gaussian blurring.

Parameters:

Returns:

Standard deviation to be passed to calculate kernel for gaussian blurring.

Return type:

float

make_params(flat_inputs: List[Any]) → Dict[str, Any][source]

Method to override for custom transforms.

See How to write your own v2 transforms

transform(inpt: Any, params: Dict[str, Any]) → Any[source]

Method to override for custom transforms.

See How to write your own v2 transforms