class_docstr: Implementation of the HopSkipJump attack from Jianbo et al. (2019). This is a powerful black-box attack that
  only requires final class prediction, and is an advanced version of the boundary attack.
  
  | Paper link: https://arxiv.org/abs/1904.02144
docstr: Internal attack function for one example.
  
  :param x: An array with one original input to be attacked.
  :param y: If `self.targeted` is true, then `y` represents the target label.
  :param y_p: The predicted label of x.
  :param init_pred: The predicted label of the initial image.
  :param adv_init: Initial array to act as an initial adversarial example.
  :param mask: An array with a mask to be applied to the adversarial perturbations. Shape needs to be
               broadcastable to the shape of x. Any features for which the mask is zero will not be adversarially
               perturbed.
  :param clip_min: Minimum value of an example.
  :param clip_max: Maximum value of an example.
  :return: An adversarial example.
docstr_tok: ["Internal","attack","function","for","one","example",".",":","param","x",":","An","array","with","one","original","input","to","be","attacked",".",":","param","y",":","If","`","self.targeted","`","is","true",",","then","`","y","`","represents","the","target","label",".",":","param","y_p",":","The","predicted","label","of","x.",":","param","init_pred",":","The","predicted","label","of","the","initial","image",".",":","param","adv_init",":","Initial","array","to","act","as","an","initial","adversarial","example",".",":","param","mask",":","An","array","with","a","mask","to","be","applied","to","the","adversarial","perturbations",".","Shape","needs","to","be","broadcastable","to","the","shape","of","x",".","Any","features","for","which","the","mask","is","zero","will","not","be","adversarially","perturbed",".",":","param","clip_min",":","Minimum","value","of","an","example",".",":","param","clip_max",":","Maximum","value","of","an","example",".",":","return",":","An","adversarial","example","."]
code: def _perturb(
      self,
      x: np.ndarray,
      y: int,
      y_p: int,
      init_pred: int,
      adv_init: np.ndarray,
      mask: Optional[np.ndarray],
      clip_min: float,
      clip_max: float,
  ) -> np.ndarray:
      """
      Internal attack function for one example.
  
      :param x: An array with one original input to be attacked.
      :param y: If `self.targeted` is true, then `y` represents the target label.
      :param y_p: The predicted label of x.
      :param init_pred: The predicted label of the initial image.
      :param adv_init: Initial array to act as an initial adversarial example.
      :param mask: An array with a mask to be applied to the adversarial perturbations. Shape needs to be
                   broadcastable to the shape of x. Any features for which the mask is zero will not be adversarially
                   perturbed.
      :param clip_min: Minimum value of an example.
      :param clip_max: Maximum value of an example.
      :return: An adversarial example.
      """
      # First, create an initial adversarial sample
      initial_sample = self._init_sample(
          x, y, y_p, init_pred, adv_init, mask, clip_min, clip_max
      )
  
      # If an initial adversarial example is not found, then return the original image
      if initial_sample is None:
          return x
  
      # If an initial adversarial example found, then go with HopSkipJump attack
      x_adv = self._attack(
          initial_sample[0],
          x,
          initial_sample[1],
          mask,
          clip_min,
          clip_max,
      )
  
      return x_adv
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from tqdm.auto import tqdm
  from art.config import ART_NUMPY_DTYPE
  from art.attacks.attack import EvasionAttack
  from art.estimators.estimator import BaseEstimator
  from art.estimators.classification import ClassifierMixin
  from art.utils import compute_success, to_categorical, check_and_transform_label_format, get_labels_np_array
label_desc: Use image node_id 3 for calling the HopSkipJump obj's underlying member method code with example usage: obj._perturb(x, y, y_p, init_pred, adv_init, mask, clip_min, clip_max) and returns: x_adv, x