code: def test_sliding_window_default(
      self, image_shape, roi_shape, sw_batch_size, overlap, mode, device
  ):
      n_total = np.prod(image_shape)
      if mode == "constant":
          inputs = torch.arange(n_total, dtype=torch.float).reshape(
              *image_shape
          )
      else:
          inputs = torch.ones(*image_shape, dtype=torch.float)
      if device.type == "cuda" and not torch.cuda.is_available():
          device = torch.device("cpu:0")
  
      def compute(data):
          return data + 1
  
      if mode == "constant":
          expected_val = (
              np.arange(n_total, dtype=np.float32).reshape(*image_shape)
              + 1.0
          )
      else:
          expected_val = np.ones(image_shape, dtype=np.float32) + 1.0
      result = sliding_window_inference(
          inputs.to(device),
          roi_shape,
          sw_batch_size,
          compute,
          overlap,
          mode=mode,
      )
      np.testing.assert_string_equal(device.type, result.device.type)
      np.testing.assert_allclose(result.cpu().numpy(), expected_val)
  
      result = SlidingWindowInferer(
          roi_shape, sw_batch_size, overlap, mode
      )(inputs.to(device), compute)
      np.testing.assert_string_equal(device.type, result.device.type)
      np.testing.assert_allclose(result.cpu().numpy(), expected_val)
  
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 2 for calling the TestSlidingWindowInference obj's underlying member method code with example usage: obj.test_sliding_window_default(image_shape, roi_shape, sw_batch_size, overlap, mode, device) and returns: unknown