def _apply_preprocessing(self, x: np.ndarray) -> np.ndarray:
        """
        Helper function to preprocess the input for use with computing the loss gradient.
        :param x: The input to preprocess
        :return: Preprocessed input
        """
        if x.shape == self.estimator.input_shape:
            x_expanded = np.expand_dims(x, 0)
        else:
            x_expanded = x

        # Apply preprocessing
        x_preprocessed, _ = self.estimator._apply_preprocessing(x=x_expanded, y=None, fit=False)
        return x_preprocessed

        Helper function to preprocess the input for use with computing the loss gradient.
        :param x: The input to preprocess
        :return: Preprocessed input
        
art/attacks/poisoning/hidden_trigger_backdoor/hidden_trigger_backdoor_keras.py