code: def test_shape(self, input_data, expected_shape):
      if input_data["model"] == "densenet2d":
          model = DenseNet121(
              spatial_dims=2, in_channels=1, out_channels=3
          )
      if input_data["model"] == "densenet3d":
          model = DenseNet(
              spatial_dims=3,
              in_channels=1,
              out_channels=3,
              init_features=2,
              growth_rate=2,
              block_config=(6,),
          )
      if input_data["model"] == "senet2d":
          model = SEResNet50(
              spatial_dims=2, in_channels=3, num_classes=4
          )
      if input_data["model"] == "senet3d":
          model = SEResNet50(
              spatial_dims=3, in_channels=3, num_classes=4
          )
      device = "cuda:0" if torch.cuda.is_available() else "cpu"
      model.to(device)
      model.eval()
      cam = CAM(
          nn_module=model,
          target_layers=input_data["target_layers"],
          fc_layers=input_data["fc_layers"],
      )
      image = torch.rand(input_data["shape"], device=device)
      result = cam(x=image, layer_idx=-1)
      fea_shape = cam.feature_map_size(
          input_data["shape"], device=device
      )
      self.assertTupleEqual(fea_shape, input_data["feature_shape"])
      self.assertTupleEqual(result.shape, expected_shape)
  
file_path: MONAI/tests/test_vis_cam.py
imports: from __future__ import annotations
  import unittest
  import torch
  from parameterized import parameterized
  from monai.networks.nets import DenseNet, DenseNet121, SEResNet50
  from monai.visualize import CAM
label_desc: Use image node_id 1 for calling the TestClassActivationMap obj's underlying member method code with example usage: obj.test_shape(input_data, expected_shape) without return types