def eval_and_certify(
        self,
        x: np.ndarray,
        y: np.ndarray,
        size_to_certify: int,
        batch_size: int = 128,
        verbose: bool = True,
    ) -> tuple["tf.Tensor", "tf.Tensor"]:
        """
        Evaluates the normal and certified performance over the supplied data.

        :param x: Evaluation data.
        :param y: Evaluation labels.
        :param size_to_certify: The size of the patch to certify against.
                                If not provided will default to the ablation size.
        :param batch_size: batch size when evaluating.
        :param verbose: If to display the progress bar
        :return: The accuracy and certified accuracy over the dataset
        """
        import tensorflow as tf

        y = check_and_transform_label_format(y, nb_classes=self.nb_classes)

        # Apply preprocessing
        x_preprocessed, y_preprocessed = self._apply_preprocessing(x, y, fit=True)

        num_batch = int(np.ceil(len(x_preprocessed) / float(batch_size)))
        pbar = tqdm(range(num_batch), disable=not verbose)
        accuracy = tf.constant(np.array(0.0), dtype=tf.dtypes.int32)
        cert_sum = tf.constant(np.array(0.0), dtype=tf.dtypes.int32)
        n_samples = 0

        for m in pbar:
            if m == (num_batch - 1):
                i_batch = np.copy(x_preprocessed[m * batch_size :])
                o_batch = y_preprocessed[m * batch_size :]
            else:
                i_batch = np.copy(x_preprocessed[m * batch_size : (m + 1) * batch_size])
                o_batch = y_preprocessed[m * batch_size : (m + 1) * batch_size]

            pred_counts = self.predict(i_batch)

            _, cert_and_correct, top_predicted_class = self.ablator.certify(
                pred_counts, size_to_certify=size_to_certify, label=o_batch
            )
            cert_sum += tf.math.reduce_sum(tf.where(cert_and_correct, 1, 0))
            accuracy += tf.math.reduce_sum(tf.where(top_predicted_class == np.argmax(o_batch, axis=-1), 1, 0))
            n_samples += len(cert_and_correct)

            pbar.set_description(f"Normal Acc {accuracy / n_samples:.3f} " f"Cert Acc {cert_sum / n_samples:.3f}")
        return (accuracy / n_samples), (cert_sum / n_samples)

        Evaluates the normal and certified performance over the supplied data.

        :param x: Evaluation data.
        :param y: Evaluation labels.
        :param size_to_certify: The size of the patch to certify against.
                                If not provided will default to the ablation size.
        :param batch_size: batch size when evaluating.
        :param verbose: If to display the progress bar
        :return: The accuracy and certified accuracy over the dataset
        
art/estimators/certification/derandomized_smoothing/tensorflow.py