code: def test_end_to_end_equivalence(
      art_warning, fix_get_mnist_data, fix_get_cifar10_data, ablation
  ):
      """
      Assert implementations matches original with a forward pass through the same model architecture.
      There are some differences in architecture between the same model names in timm vs the original implementation.
      We use vit_base_patch16_224 which matches.
      """
      import torch
  
      device = torch.device(
          "cuda" if torch.cuda.is_available() else "cpu"
      )
  
      from art.estimators.certification.derandomized_smoothing import (
          PyTorchDeRandomizedSmoothing,
      )
  
      from art.estimators.certification.derandomized_smoothing.ablators import (
          ColumnAblatorPyTorch,
          BlockAblatorPyTorch,
      )
  
      cifar_data = fix_get_cifar10_data[0][:50]
      torch.manual_seed(1234)
      try:
          art_model = PyTorchDeRandomizedSmoothing(
              model="vit_base_patch16_224",
              loss=torch.nn.CrossEntropyLoss(),
              optimizer=torch.optim.SGD,
              optimizer_params={"lr": 0.01},
              input_shape=(3, 32, 32),
              nb_classes=10,
              ablation_size=4,
              load_pretrained=True,
              replace_last_layer=True,
              verbose=False,
          )
  
          if ablation == "column":
              ablator = ColumnAblatorPyTorch(
                  ablation_size=4,
                  channels_first=True,
                  to_reshape=True,
                  mode="ViT",
                  original_shape=(3, 32, 32),
                  output_shape=(3, 224, 224),
              )
              ablated = ablator.forward(cifar_data, column_pos=10)
              madry_preds = torch.load(
                  os.path.join(
                      os.path.dirname(os.path.dirname(__file__)),
                      "../../utils/resources/models/certification/smooth_vit/madry_preds_column.pt",
                  )
              )
              art_preds = art_model.model(ablated)
              assert torch.allclose(
                  madry_preds.to(device),
                  art_preds,
                  rtol=1e-04,
                  atol=1e-04,
              )
  
          elif ablation == "block":
              ablator = BlockAblatorPyTorch(
                  ablation_size=4,
                  channels_first=True,
                  to_reshape=True,
                  original_shape=(3, 32, 32),
                  output_shape=(3, 224, 224),
                  mode="ViT",
              )
              ablated = ablator.forward(
                  cifar_data, column_pos=10, row_pos=28
              )
              madry_preds = torch.load(
                  os.path.join(
                      os.path.dirname(os.path.dirname(__file__)),
                      "../../utils/resources/models/certification/smooth_vit/madry_preds_block.pt",
                  )
              )
              art_preds = art_model.model(ablated)
              assert torch.allclose(
                  madry_preds.to(device),
                  art_preds,
                  rtol=1e-04,
                  atol=1e-04,
              )
      except ARTTestException as e:
          art_warning(e)
  
file_path: adversarial-robustness-toolbox/tests/estimators/certification/test_vision_transformers.py
imports: import pytest
  import os
  import numpy
  from art.utils import load_dataset
  from tests.utils import ARTTestException
label_desc: Use image node_id 7 for calling a global function with example usage: test_end_to_end_equivalence(art_warning, fix_get_mnist_data, fix_get_cifar10_data, ablation) without return types