code: def _filter(
      win_size: float,
      sigma: float,
      dtype: torch.dtype,
      device: torch.device,
  ) -> Tensor:
      # This code is inspired by
      # https://github.com/andrewekhalel/sewar/blob/ac76e7bc75732fde40bb0d3908f4b6863400cc27/sewar/utils.py#L45
      # https://github.com/photosynthesis-team/piq/blob/01e16b7d8c76bc8765fb6a69560d806148b8046a/piq/functional/filters.py#L38
      # Both links do the same, but the second one is cleaner
      coords = (
          torch.arange(win_size, dtype=dtype, device=device)
          - (win_size - 1) / 2
      )
      g = coords**2
      g = torch.exp(
          -(g.unsqueeze(0) + g.unsqueeze(1)) / (2.0 * sigma**2)
      )
      g /= torch.sum(g)
      return g
  
imports: import torch
  from torch import Tensor
  from torch.nn.functional import conv2d
  from torchmetrics.utilities.distributed import reduce
label_desc: Use image node_id 1 for calling a global function with example usage: _filter(win_size, sigma, dtype, device) and returns: g