code: def test_sigma(self):
      device = "cuda" if torch.cuda.is_available() else "cpu:0"
      inputs = torch.ones((1, 1, 7, 7)).to(device=device)
      roi_shape = (3, 3)
      sw_batch_size = 10
  
      class _Pred:
          add = 1
  
          def compute(self, data):
              self.add += 1
              return data + self.add
  
      result = sliding_window_inference(
          inputs,
          roi_shape,
          sw_batch_size,
          _Pred().compute,
          overlap=0.5,
          padding_mode="constant",
          cval=-1,
          mode="constant",
          sigma_scale=1.0,
      )
  
      expected = np.array(
          [
              [
                  [
                      [
                          3.0000,
                          3.0000,
                          3.0000,
                          3.0000,
                          3.0000,
                          3.0000,
                          3.0000,
                      ],
                      [
                          3.0000,
                          3.0000,
                          3.0000,
                          3.0000,
                          3.0000,
                          3.0000,
                          3.0000,
                      ],
                      [
                          3.3333,
                          3.3333,
                          3.3333,
                          3.3333,
                          3.3333,
                          3.3333,
                          3.3333,
                      ],
                      [
                          3.6667,
                          3.6667,
                          3.6667,
                          3.6667,
                          3.6667,
                          3.6667,
                          3.6667,
                      ],
                      [
                          4.3333,
                          4.3333,
                          4.3333,
                          4.3333,
                          4.3333,
                          4.3333,
                          4.3333,
                      ],
                      [
                          4.5000,
                          4.5000,
                          4.5000,
                          4.5000,
                          4.5000,
                          4.5000,
                          4.5000,
                      ],
                      [
                          5.0000,
                          5.0000,
                          5.0000,
                          5.0000,
                          5.0000,
                          5.0000,
                          5.0000,
                      ],
                  ]
              ]
          ]
      )
      np.testing.assert_allclose(
          result.cpu().numpy(), expected, rtol=1e-4
      )
      result = sliding_window_inference(
          inputs,
          roi_shape,
          sw_batch_size,
          _Pred().compute,
          overlap=0.5,
          padding_mode="constant",
          cval=-1,
          mode="gaussian",
          sigma_scale=1.0,
          progress=has_tqdm,
      )
      expected = np.array(
          [
              [
                  [
                      [3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0],
                      [3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0],
                      [
                          3.3271625,
                          3.3271623,
                          3.3271623,
                          3.3271623,
                          3.3271623,
                          3.3271623,
                          3.3271625,
                      ],
                      [
                          3.6728377,
                          3.6728377,
                          3.6728377,
                          3.6728377,
                          3.6728377,
                          3.6728377,
                          3.6728377,
                      ],
                      [
                          4.3271623,
                          4.3271623,
                          4.3271627,
                          4.3271627,
                          4.3271627,
                          4.3271623,
                          4.3271623,
                      ],
                      [
                          4.513757,
                          4.513757,
                          4.513757,
                          4.513757,
                          4.513757,
                          4.513757,
                          4.513757,
                      ],
                      [4.9999995, 5.0, 5.0, 5.0, 5.0, 5.0, 4.9999995],
                  ]
              ]
          ]
      )
      np.testing.assert_allclose(
          result.cpu().numpy(), expected, rtol=1e-4
      )
  
      result = SlidingWindowInferer(
          roi_shape,
          sw_batch_size,
          overlap=0.5,
          mode="gaussian",
          sigma_scale=1.0,
      )(inputs, _Pred().compute)
      np.testing.assert_allclose(
          result.cpu().numpy(), expected, rtol=1e-4
      )
  
      result = SlidingWindowInferer(
          roi_shape,
          sw_batch_size,
          overlap=0.5,
          mode="gaussian",
          sigma_scale=[1.0, 1.0],
      )(inputs, _Pred().compute)
      np.testing.assert_allclose(
          result.cpu().numpy(), expected, rtol=1e-4
      )
  
      result = SlidingWindowInferer(
          roi_shape,
          sw_batch_size,
          overlap=0.5,
          mode="gaussian",
          sigma_scale=[1.0, 1.0],
          cache_roi_weight_map=True,
      )(inputs, _Pred().compute)
      np.testing.assert_allclose(
          result.cpu().numpy(), expected, rtol=1e-4
      )
  
file_path: MONAI/tests/test_sliding_window_inference.py
imports: from __future__ import annotations
  import itertools
  import unittest
  import numpy
  import torch
  from parameterized import parameterized
  from monai.data.utils import list_data_collate
  from monai.inferers import SlidingWindowInferer, SlidingWindowInfererAdapt, sliding_window_inference
  from monai.utils import optional_import
  from tests.utils import TEST_TORCH_AND_META_TENSORS, skip_if_no_cuda, test_is_quick
label_desc: Use image node_id 5 for calling the TestSlidingWindowInference obj's underlying member method code with example usage: obj.test_sigma() and returns: unknown