code: def test_ssim_device(available_device, metric_device, y_pred_device):
      if available_device == "cpu":
          pytest.skip("This test requires a cuda device.")
  
      data_range = 1.0
      sigma = 1.5
      shape = (12, 5, 256, 256)
  
      ssim = SSIM(
          data_range=data_range, sigma=sigma, device=metric_device
      )
  
      y_pred = torch.rand(shape, device=y_pred_device)
      y = y_pred * 0.8
  
      if metric_device == torch.device(
          "cuda"
      ) and y_pred_device == torch.device("cpu"):
          with pytest.warns(UserWarning):
              ssim.update((y_pred, y))
      else:
          ssim.update((y_pred, y))
  
      if metric_device == torch.device(
          "cuda"
      ) or y_pred_device == torch.device("cuda"):
          # A tensor will always have the device index set
          excepted_device = torch.device("cuda:0")
      else:
          excepted_device = torch.device("cpu")
  
      assert ssim._kernel.device == excepted_device
  
file_path: ignite/tests/ignite/metrics/test_ssim.py
imports: from typing import Sequence, Union
  import numpy
  import pytest
  import torch
  from skimage.metrics import structural_similarity
  import ignite.distributed
  from ignite.exceptions import NotComputableError
  from ignite.metrics import SSIM
label_desc: Use image node_id 5 for calling a global function with example usage: test_ssim_device(available_device, metric_device, y_pred_device) without return types