def laplacian_1d(window_size: int, *, device: Optional[Device] = None, dtype: Dtype = torch.float32) -> Tensor:
    """One could also use the Laplacian of Gaussian formula to design the filter."""
    # TODO: add default dtype as None when kornia relies on torch > 1.12
    filter_1d = torch.ones(window_size, device=device, dtype=dtype)
    middle = window_size // 2
    filter_1d[middle] = 1 - window_size
    return filter_1d
One could also use the Laplacian of Gaussian formula to design the filter.
kornia/filters/kernels.py