Solved by ZimoNitrome in post #2 
              
              
                This might work: 
import torch.nn.functional as F
import torch

def make_gaussian_kernel(kernel_size, sigma):
    ts = torch.linspace(-kernel_size // 2, kernel_size // 2 + 1, kernel_size)
    gauss = torch.exp((-(ts / sigma)**2 / 2))
    kernel = gauss / gauss.sum()
    return kernel

def fast_gauss…