def __post_init__(self) -> None:
        """Validate inputs for result object consistency.

        Raises:
            TypeError: If inputs are invalid or have inconsistent shapes.
        """
        try:
            _validate.is_valid_threshold(self.thresholds)
            _validate.is_rate_curve(self.shared_fpr, nan_allowed=False, decreasing=True)  # is_shared_apr
            _validate.is_per_image_tprs(self.per_image_tprs, self.image_classes)

        except (TypeError, ValueError) as ex:
            msg = f"Invalid inputs for {self.__class__.__name__} object. Cause: {ex}."
            raise TypeError(msg) from ex

        if self.thresholds.shape != self.shared_fpr.shape:
            msg = (
                f"Invalid {self.__class__.__name__} object. "
                f"Attributes have inconsistent shapes: "
                f"{self.thresholds.shape=} != {self.shared_fpr.shape=}."
            )
            raise TypeError(msg)

        if self.thresholds.shape[0] != self.per_image_tprs.shape[1]:
            msg = (
                f"Invalid {self.__class__.__name__} object. "
                f"Attributes have inconsistent shapes: "
                f"{self.thresholds.shape[0]=} != {self.per_image_tprs.shape[1]=}."
            )
            raise TypeError(msg)
Validate inputs for result object consistency.

        Raises:
            TypeError: If inputs are invalid or have inconsistent shapes.
        
src/anomalib/metrics/pimo/dataclasses.py