def test_certification_equivalence(art_warning, fix_get_mnist_data, fix_get_cifar10_data, ablation):
    """
    With the forward pass equivalence asserted, we now confirm that the certification functions in the same
    way by doing a full end to end prediction and certification test over the data.
    """
    import torch

    from art.estimators.certification.derandomized_smoothing import PyTorchDeRandomizedSmoothing

    device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
    try:
        art_model = PyTorchDeRandomizedSmoothing(
            model="vit_small_patch16_224",
            loss=torch.nn.CrossEntropyLoss(),
            optimizer=torch.optim.SGD,
            optimizer_params={"lr": 0.01},
            input_shape=(3, 32, 32),
            nb_classes=10,
            ablation_type=ablation,
            ablation_size=4,
            load_pretrained=True,
            replace_last_layer=True,
            verbose=False,
        )

        head = {
            "weight": torch.tensor(
                np.load(
                    os.path.join(
                        os.path.dirname(os.path.dirname(__file__)),
                        "../../utils/resources/models/certification/smooth_vit/head_weight.npy",
                    )
                )
            ).to(device),
            "bias": torch.tensor(
                np.load(
                    os.path.join(
                        os.path.dirname(os.path.dirname(__file__)),
                        "../../utils/resources/models/certification/smooth_vit/head_bias.npy",
                    )
                )
            ).to(device),
        }
        art_model.model.head.load_state_dict(head)

        if torch.cuda.is_available():
            num_to_fetch = 100
        else:
            num_to_fetch = 10

        cifar_data = torch.from_numpy(fix_get_cifar10_data[0][:num_to_fetch]).to(device)
        cifar_labels = torch.from_numpy(fix_get_cifar10_data[1][:num_to_fetch]).to(device)

        acc, cert_acc = art_model.eval_and_certify(
            x=cifar_data.cpu().numpy(), y=cifar_labels.cpu().numpy(), batch_size=num_to_fetch, size_to_certify=4
        )

        upsample = torch.nn.Upsample(scale_factor=224 / 32)
        cifar_data = upsample(cifar_data)
        acc_non_ablation = art_model.model(cifar_data)
        acc_non_ablation = art_model.get_accuracy(acc_non_ablation, cifar_labels)

        if torch.cuda.is_available():
            if ablation == "column":
                assert np.allclose(cert_acc.cpu().numpy(), 0.29)
                assert np.allclose(acc.cpu().numpy(), 0.57)
            else:
                assert np.allclose(cert_acc.cpu().numpy(), 0.16)
                assert np.allclose(acc.cpu().numpy(), 0.24)
            assert np.allclose(acc_non_ablation, 0.52)
        else:
            if ablation == "column":
                assert np.allclose(cert_acc.cpu().numpy(), 0.30)
                assert np.allclose(acc.cpu().numpy(), 0.70)
            else:
                assert np.allclose(cert_acc.cpu().numpy(), 0.20)
                assert np.allclose(acc.cpu().numpy(), 0.20)
            assert np.allclose(acc_non_ablation, 0.60)
    except ARTTestException as e:
        art_warning(e)

    With the forward pass equivalence asserted, we now confirm that the certification functions in the same
    way by doing a full end to end prediction and certification test over the data.
    
tests/estimators/certification/test_vision_transformers.py