def make_gaussian_kernel(kernel_size: int) -> torch.Tensor: sigma = torch.tensor(kernel_size / 3.0) kernel = gaussian_1d(sigma=sigma, truncated=kernel_size // 2, approx="sampled", normalize=False) * (2.5066282 * sigma) return kernel[:kernel_size]
def make_gaussian_kernel(sigma: int) -> torch.Tensor: if sigma <= 0: raise ValueError(f"expecting positive sigma, got sigma={sigma}") return gaussian_1d(sigma=torch.tensor(sigma), truncated=3, approx="sampled", normalize=False)