code: def test_opencv_grayscale(self, device, dtype):
      guide = [
          [100, 130, 58, 36],
          [215, 142, 173, 166],
          [114, 150, 190, 60],
          [23, 83, 84, 216],
      ]
      guide = (
          torch.tensor(guide, device=device, dtype=dtype).view(
              1, 1, 4, 4
          )
          / 255
      )
  
      img = [
          [95, 130, 108, 228],
          [98, 142, 187, 166],
          [114, 166, 190, 141],
          [150, 83, 174, 216],
      ]
      img = (
          torch.tensor(img, device=device, dtype=dtype).view(1, 1, 4, 4)
          / 255
      )
  
      kernel_size = 3
      eps = 0.01
  
      # Expected output generated with OpenCV:
      # import cv2
      # expected = cv2.ximgproc.guidedFilter(
      #   guide.squeeze().numpy(),
      #   img.squeeze().numpy(),
      #   (kernel_size - 1) // 2,
      #   eps,
      # )
      expected = [
          [0.4487294, 0.5163902, 0.5981981, 0.70094436],
          [0.4850059, 0.53724647, 0.62616897, 0.6686147],
          [0.5010369, 0.5631456, 0.6808387, 0.5960593],
          [0.5304646, 0.53203756, 0.57674146, 0.80308396],
      ]
      expected = torch.tensor(
          expected, device=device, dtype=dtype
      ).view(1, 1, 4, 4)
  
      # OpenCV uses hard-coded BORDER_REFLECT mode, which also reflects the outermost pixels
      # https://github.com/opencv/opencv_contrib/blob/853144ef93c4ffa55661619b861539090943c5b6/modules/ximgproc/src/guided_filter.cpp#L162
      # PyTorch's `reflect` border type corresponds to OpenCV's BORDER_REFLECT_101
      # To match the border's behavior, we use kernel_size = 3 and border_type="replicate" for testing
      out = guided_blur(
          guide, img, kernel_size, eps, border_type="replicate"
      )
      self.assert_close(out, expected)
  
file_path: kornia/test/filters/test_guided.py
imports: import pytest
  import torch
  from kornia.filters import GuidedBlur, guided_blur
  from kornia.testing import BaseTester, tensor_to_gradcheck_var
  from kornia.utils._compat import torch_version
label_desc: Use image node_id 8 for calling the TestGuidedBlur obj's underlying member method code with example usage: obj.test_opencv_grayscale(device, dtype) without return types