def forward(self, images: torch.Tensor) -> tuple[torch.Tensor, torch.Tensor] | InferenceBatch:
        """Forward method of the model.

        Args:
            images (torch.Tensor): Input images.

        Returns:
            tuple[torch.Tensor, torch.Tensor]: During training: tuple containing the z_distribution for three scales
                and the sum of log determinant of the Jacobian. During evaluation: tuple containing anomaly maps
                and anomaly scores
        """
        features = self.feature_extractor(images)
        if self.training:
            return self.graph(features)

        z_dist, _ = self.graph(features)  # Ignore Jacobians
        anomaly_scores = self._compute_anomaly_scores(z_dist)
        anomaly_maps = self.anomaly_map_generator(z_dist)
        return InferenceBatch(pred_score=anomaly_scores, anomaly_map=anomaly_maps)
Forward method of the model.

        Args:
            images (torch.Tensor): Input images.

        Returns:
            tuple[torch.Tensor, torch.Tensor]: During training: tuple containing the z_distribution for three scales
                and the sum of log determinant of the Jacobian. During evaluation: tuple containing anomaly maps
                and anomaly scores
        
src/anomalib/models/image/csflow/torch_model.py