import torch


def gauss_kernel_1d(l, sig):
    """
    creates gaussian kernel with side length l and a sigma of sig
    """
    xx = torch.arange(-l // 2 + 1., l // 2 + 1)
    kernel = torch.exp(-xx**2 / (2. * sig**2))
    return kernel / kernel.sum()