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: Compute the update in Eq.(14).
  
  :param current_sample: Current adversarial example.
  :param num_eval: The number of evaluations for estimating gradient.
  :param delta: The size of random perturbation.
  :param target: The target label.
  :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 updated perturbation.
docstr_tok: ["Compute","the","update","in","Eq.","(","14",")",".",":","param","current_sample",":","Current","adversarial","example",".",":","param","num_eval",":","The","number","of","evaluations","for","estimating","gradient",".",":","param","delta",":","The","size","of","random","perturbation",".",":","param","target",":","The","target","label",".",":","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","updated","perturbation","."]
code: def _compute_update(
      self,
      current_sample: np.ndarray,
      num_eval: int,
      delta: float,
      target: int,
      mask: Optional[np.ndarray],
      clip_min: float,
      clip_max: float,
  ) -> np.ndarray:
      """
      Compute the update in Eq.(14).
  
      :param current_sample: Current adversarial example.
      :param num_eval: The number of evaluations for estimating gradient.
      :param delta: The size of random perturbation.
      :param target: The target label.
      :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 updated perturbation.
      """
      # Generate random noise
      rnd_noise_shape = [num_eval] + list(self.estimator.input_shape)
      if self.norm == 2:
          rnd_noise = np.random.randn(*rnd_noise_shape).astype(
              ART_NUMPY_DTYPE
          )
      else:
          rnd_noise = np.random.uniform(
              low=-1, high=1, size=rnd_noise_shape
          ).astype(ART_NUMPY_DTYPE)
  
      # With mask
      if mask is not None:
          rnd_noise = rnd_noise * mask
  
      # Normalize random noise to fit into the range of input data
      rnd_noise = rnd_noise / np.sqrt(
          np.sum(
              rnd_noise**2,
              axis=tuple(range(len(rnd_noise_shape)))[1:],
              keepdims=True,
          )
      )
      eval_samples = np.clip(
          current_sample + delta * rnd_noise, clip_min, clip_max
      )
      rnd_noise = (eval_samples - current_sample) / delta
  
      # Compute gradient: This is a bit different from the original paper, instead we keep those that are
      # implemented in the original source code of the authors
      satisfied = self._adversarial_satisfactory(
          samples=eval_samples,
          target=target,
          clip_min=clip_min,
          clip_max=clip_max,
      )
      f_val = (
          2
          * satisfied.reshape(
              [num_eval] + [1] * len(self.estimator.input_shape)
          )
          - 1.0
      )
      f_val = f_val.astype(ART_NUMPY_DTYPE)
  
      if np.mean(f_val) == 1.0:
          grad = np.mean(rnd_noise, axis=0)
      elif np.mean(f_val) == -1.0:
          grad = -np.mean(rnd_noise, axis=0)
      else:
          f_val -= np.mean(f_val)
          grad = np.mean(f_val * rnd_noise, axis=0)
  
      # Compute update
      if self.norm == 2:
          result = grad / np.linalg.norm(grad)
      else:
          result = np.sign(grad)
  
      return result
  
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 8 for calling the HopSkipJump obj's underlying member method code with example usage: obj._compute_update(current_sample, num_eval, delta, target, mask, clip_min, clip_max) and returns: result