import torch


def _fspecial_gauss_1d(size: int, sigma: float) -> torch.Tensor:
    """
        Function to mimic the 'fspecial' gaussian MATLAB function.

        Args:
            size (int): the size of gauss kernel
            sigma (float): sigma of normal distribution

        Returns:
            torch.Tensor: 1D gaussian kernel (1 x 1 x size)
    """
    coords = torch.arange(size).to(dtype=torch.float)
    coords -= size // 2

    g = torch.exp(-(coords ** 2) / (2 * sigma ** 2))
    g /= g.sum()

    return g.unsqueeze(0).unsqueeze(0)