Skip to content
Advertisement

Gaussian filter in PyTorch

I am looking for a way to apply a Gaussian filter to an image (tensor) only using PyTorch functions. Using numpy, the equivalent code is

JavaScript

The closest suggestion I found is based on this post:

JavaScript

But it gives me the error NameError: name 'gaussian_weights' is not defined. How can I make it work?

Advertisement

Answer

There is a Pytorch class to apply Gaussian Blur to your image:

JavaScript

Check the documentation for more info

Advertisement