def eval_and_certify(
        self,
        x: np.ndarray,
        y: np.ndarray,
        size_to_certify: int,
        batch_size: int = 128,
        verbose: bool = True,
    ) -> tuple["torch.Tensor", "torch.Tensor"]:
        """
        Evaluates the ViT's 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 torch

        self.model.eval()
        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)

        # Check label shape
        y_preprocessed = self.reduce_labels(y_preprocessed)

        num_batch = int(np.ceil(len(x_preprocessed) / float(batch_size)))
        pbar = tqdm(range(num_batch), disable=not verbose)
        accuracy = torch.tensor(0.0).to(self._device)
        cert_sum = torch.tensor(0.0).to(self._device)
        n_samples = 0

        with torch.no_grad():
            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 = np.zeros((len(i_batch), self.nb_classes))
                if self.ablation_type in {"column", "row"}:
                    for pos in range(i_batch.shape[-1]):
                        ablated_batch = self.ablator.forward(i_batch, column_pos=pos)
                        # Perform prediction
                        model_outputs = self.model(ablated_batch)

                        if self.algorithm == "salman2021":
                            pred_counts[np.arange(0, len(i_batch)), model_outputs.argmax(dim=-1).cpu()] += 1
                        else:
                            if self.logits:
                                model_outputs = torch.nn.functional.softmax(model_outputs, dim=1)
                            model_outputs = model_outputs >= self.threshold
                            pred_counts += model_outputs.cpu().numpy()

                else:
                    for column_pos in range(i_batch.shape[-1]):
                        for row_pos in range(i_batch.shape[-2]):
                            ablated_batch = self.ablator.forward(i_batch, column_pos=column_pos, row_pos=row_pos)
                            model_outputs = self.model(ablated_batch)

                            if self.algorithm == "salman2021":
                                pred_counts[np.arange(0, len(i_batch)), model_outputs.argmax(dim=-1).cpu()] += 1
                            else:
                                if self.logits:
                                    model_outputs = torch.nn.functional.softmax(model_outputs, dim=1)
                                model_outputs = model_outputs >= self.threshold
                                pred_counts += model_outputs.cpu().numpy()

                _, cert_and_correct, top_predicted_class = self.ablator.certify(
                    pred_counts, size_to_certify=size_to_certify, label=o_batch
                )
                cert_sum += torch.sum(cert_and_correct)
                o_batch = torch.from_numpy(o_batch).to(self.device)
                accuracy += torch.sum(top_predicted_class == o_batch)
                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 ViT's 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/pytorch.py