| 708 | """ |
| 709 | |
| 710 | def __init__( |
| 711 | self, cam_name: str, target_layers: str, class_idx: int | None = None, *args: Any, **kwargs: Any |
| 712 | ) -> None: |
| 713 | Inferer.__init__(self) |
| 714 | if cam_name.lower() not in ("cam", "gradcam", "gradcampp"): |
| 715 | raise ValueError("cam_name should be: 'CAM', 'GradCAM' or 'GradCAMpp'.") |
| 716 | self.cam_name = cam_name.lower() |
| 717 | self.target_layers = target_layers |
| 718 | self.class_idx = class_idx |
| 719 | self.args = args |
| 720 | self.kwargs = kwargs |
| 721 | |
| 722 | def __call__(self, inputs: torch.Tensor, network: nn.Module, *args: Any, **kwargs: Any): # type: ignore |
| 723 | """Unified callable function API of Inferers. |