code: def test_shape(self):
      set_determinism(0)
      preds = torch.abs(torch.randn(2, 3, 16, 16))
      target = torch.abs(torch.randn(2, 3, 16, 16))
      preds = preds / preds.max()
      target = target / target.max()
  
      result = SSIMLoss(
          spatial_dims=2,
          data_range=1.0,
          kernel_type="gaussian",
          reduction="mean",
      ).forward(preds, target)
      expected_val = 0.9546
      np.testing.assert_allclose(
          result.detach().cpu().numpy(), expected_val, rtol=1e-4
      )
  
      result = SSIMLoss(
          spatial_dims=2,
          data_range=1.0,
          kernel_type="gaussian",
          reduction="sum",
      ).forward(preds, target)
      expected_val = 1.9092
      np.testing.assert_allclose(
          result.detach().cpu().numpy(), expected_val, rtol=1e-4
      )
  
      result = SSIMLoss(
          spatial_dims=2,
          data_range=1.0,
          kernel_type="gaussian",
          reduction="none",
      ).forward(preds, target)
      expected_val = [[0.9121], [0.9971]]
      np.testing.assert_allclose(
          result.detach().cpu().numpy(), expected_val, rtol=1e-4
      )
  
file_path: MONAI/tests/test_ssim_loss.py
imports: from __future__ import annotations
  import unittest
  import numpy
  import torch
  from monai.losses.ssim_loss import SSIMLoss
  from monai.utils import set_determinism
label_desc: Use image node_id 1 for calling the TestSSIMLoss obj's underlying member method code with example usage: obj.test_shape() without return types