import torch


def gaussian(window_size, sigma):
    """
        Computer Gaussian.

    """

    x = torch.arange(window_size) - window_size // 2
    if window_size % 2 == 0:
        x = x + 0.5
    gauss = torch.exp((-x.pow(2.0) / (2 * sigma ** 2)))

    return gauss / gauss.sum()