code: def test_pointwise_untargeted_attack(
      request: Any,
      fmodel_and_data_ext_for_attacks: ModeAndDataAndDescription,
      attack: fa.PointwiseAttack,
  ) -> None:
      (
          (fmodel, x, y),
          real,
          low_dimensional_input,
      ) = fmodel_and_data_ext_for_attacks
  
      if not low_dimensional_input or not real:
          pytest.skip()
  
      x = (x - fmodel.bounds.lower) / (
          fmodel.bounds.upper - fmodel.bounds.lower
      )
      fmodel = fmodel.transform_bounds((0, 1))
  
      init_attack = fa.SaltAndPepperNoiseAttack(steps=50)
      init_advs = init_attack.run(fmodel, x, y)
  
      advs = attack.run(fmodel, x, y, starting_points=init_advs)
  
      init_norms_l0 = ep.norms.lp(flatten(init_advs - x), p=0, axis=-1)
      norms_l0 = ep.norms.lp(flatten(advs - x), p=0, axis=-1)
  
      init_norms_l2 = ep.norms.lp(flatten(init_advs - x), p=2, axis=-1)
      norms_l2 = ep.norms.lp(flatten(advs - x), p=2, axis=-1)
  
      is_smaller_l0 = norms_l0 < init_norms_l0
      is_smaller_l2 = norms_l2 < init_norms_l2
  
      assert fbn.accuracy(fmodel, advs, y) < fbn.accuracy(fmodel, x, y)
      assert fbn.accuracy(fmodel, advs, y) <= fbn.accuracy(
          fmodel, init_advs, y
      )
      assert is_smaller_l2.any()
      assert is_smaller_l0.any()
  
file_path: foolbox/tests/test_pointwise_attack.py
imports: from typing import List, Any
  import eagerpy
  import foolbox
  import foolbox.attacks
  from foolbox.devutils import flatten
  import pytest
  from conftest import ModeAndDataAndDescription
label_desc: Use image node_id 2 for calling a global function with example usage: test_pointwise_untargeted_attack(request, fmodel_and_data_ext_for_attacks, attack) without return types