class_docstr: Base class for CAM methods.
code: def __init__(
      self,
      nn_module: nn.Module,
      target_layers: str,
      upsampler: Callable = default_upsampler,
      postprocessing: Callable = default_normalizer,
      register_backward: bool = True,
  ) -> None:
      self.nn_module: ModelWithHooks
      # Convert to model with hooks if necessary
      if not isinstance(nn_module, ModelWithHooks):
          self.nn_module = ModelWithHooks(
              nn_module,
              target_layers,
              register_forward=True,
              register_backward=register_backward,
          )
      else:
          self.nn_module = nn_module
  
      self.upsampler = upsampler
      self.postprocessing = postprocessing
  
imports: from __future__ import annotations
  import warnings
  from collections.abc import Callable, Sequence
  from typing import cast
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from monai.config import NdarrayTensor
  from monai.transforms import ScaleIntensity
  from monai.utils import ensure_tuple, pytorch_after
  from monai.visualize.visualizer import default_upsampler
label_desc: Use image node_id 1 to create a new CAMBase object  with example: obj = CAMBase(nn_module, target_layers, upsampler, postprocessing, register_backward)