code: def test_multioutput(self):
      device = "cuda" if torch.cuda.is_available() else "cpu:0"
      inputs = torch.ones((1, 6, 20, 20)).to(device=device)
      roi_shape = (8, 8)
      sw_batch_size = 10
  
      def compute(data):
          return (
              data + 1,
              data[:, ::3, ::2, ::2] + 2,
              data[:, ::2, ::4, ::4] + 3,
          )
  
      def compute_dict(data):
          return {
              1: data + 1,
              2: data[:, ::3, ::2, ::2] + 2,
              3: data[:, ::2, ::4, ::4] + 3,
          }
  
      result = sliding_window_inference(
          inputs,
          roi_shape,
          sw_batch_size,
          compute,
          0.5,
          "constant",
          1.0,
          "constant",
          0.0,
          device,
          device,
          has_tqdm,
          None,
      )
      result_dict = sliding_window_inference(
          inputs,
          roi_shape,
          sw_batch_size,
          compute_dict,
          0.5,
          "constant",
          1.0,
          "constant",
          0.0,
          device,
          device,
          has_tqdm,
          None,
      )
      expected = (
          np.ones((1, 6, 20, 20)) + 1,
          np.ones((1, 2, 10, 10)) + 2,
          np.ones((1, 3, 5, 5)) + 3,
      )
      expected_dict = {
          1: np.ones((1, 6, 20, 20)) + 1,
          2: np.ones((1, 2, 10, 10)) + 2,
          3: np.ones((1, 3, 5, 5)) + 3,
      }
      for rr, ee in zip(result, expected):
          np.testing.assert_allclose(rr.cpu().numpy(), ee, rtol=1e-4)
      for rr, _ in zip(result_dict, expected_dict):
          np.testing.assert_allclose(
              result_dict[rr].cpu().numpy(),
              expected_dict[rr],
              rtol=1e-4,
          )
  
      result = SlidingWindowInferer(
          roi_shape,
          sw_batch_size,
          overlap=0.5,
          mode="constant",
          cval=-1,
          progress=has_tqdm,
      )(inputs, compute)
      for rr, ee in zip(result, expected):
          np.testing.assert_allclose(rr.cpu().numpy(), ee, rtol=1e-4)
  
      result_dict = SlidingWindowInferer(
          roi_shape,
          sw_batch_size,
          overlap=0.5,
          mode="constant",
          cval=-1,
          progress=has_tqdm,
      )(inputs, compute_dict)
      for rr, _ in zip(result_dict, expected_dict):
          np.testing.assert_allclose(
              result_dict[rr].cpu().numpy(),
              expected_dict[rr],
              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 8 for calling the TestSlidingWindowInference obj's underlying member method code with example usage: obj.test_multioutput() and returns: unknown,  unknown,  unknown, dict