def predict(self, x: np.ndarray, batch_size: int = 128, training_mode: bool = False, **kwargs) -> np.ndarray:
        """
        Perform prediction of the given classifier for a batch of inputs, potentially filtering suspicious input

        :param x: Input samples.
        :param batch_size: Batch size.
        :return: Array of predictions of shape `(nb_inputs, nb_classes)`.
        """
        predictions = self._predict_classifier(x=x, batch_size=batch_size, training_mode=training_mode, **kwargs)

        if len(self.top_indices) == 0:
            logger.warning("Filtering mitigation not activated, suspected backdoors may be triggered")
            return predictions

        all_activations = self._get_penultimate_layer_activations(x)
        suspected_neuron_activations = all_activations[:, self.top_indices]
        predictions[np.any(suspected_neuron_activations > self.activation_threshold, axis=1)] = self.abstain()

        return predictions

        Perform prediction of the given classifier for a batch of inputs, potentially filtering suspicious input

        :param x: Input samples.
        :param batch_size: Batch size.
        :return: Array of predictions of shape `(nb_inputs, nb_classes)`.
        
art/estimators/poison_mitigation/neural_cleanse/neural_cleanse.py