class_docstr: Implementation of Gradient Matching Attack by Geiping, et. al. 2020.
  "Witches' Brew: Industrial Scale Data Poisoning via Gradient Matching"
  
  | Paper link: https://arxiv.org/abs/2009.02276
class_docstr_tok: ["Implementation","of","Gradient","Matching","Attack","by","Geiping",",","et",".","al",".","2020",".","``","Witches","'","Brew",":","Industrial","Scale","Data","Poisoning","via","Gradient","Matching","''","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/2009.02276"]
docstr: Optimize the poison by matching the gradient within the perturbation budget.
  
  :param x_poison: List of samples to poison.
  :param y_poison: List of the labels for x_poison.
  :return: A pair of poisoned samples, B-score (cosine similarity of the gradients).
docstr_tok: ["Optimize","the","poison","by","matching","the","gradient","within","the","perturbation","budget",".",":","param","x_poison",":","List","of","samples","to","poison",".",":","param","y_poison",":","List","of","the","labels","for","x_poison",".",":","return",":","A","pair","of","poisoned","samples",",","B-score","(","cosine","similarity","of","the","gradients",")","."]
code: def _poison__tensorflow(
      self, x_poison: np.ndarray, y_poison: np.ndarray
  ) -> Tuple[Any, Any]:
      """
      Optimize the poison by matching the gradient within the perturbation budget.
  
      :param x_poison: List of samples to poison.
      :param y_poison: List of the labels for x_poison.
      :return: A pair of poisoned samples, B-score (cosine similarity of the gradients).
      """
      self.backdoor_model.compile(loss=None, optimizer=self.optimizer)
  
      callbacks = [self.lr_schedule]
      if self.verbose > 0:
          from tqdm.keras import TqdmCallback
  
          callbacks.append(TqdmCallback(verbose=self.verbose - 1))
  
      # Train the noise.
      self.backdoor_model.fit(
          [x_poison, y_poison, np.arange(len(y_poison))],
          callbacks=callbacks,
          batch_size=self.batch_size,
          initial_epoch=self.initial_epoch,
          epochs=self.max_epochs,
          verbose=0,
      )
      [
          input_noised_,
          B_,
      ] = self.backdoor_model.predict(  # pylint: disable=C0103
          [x_poison, y_poison, np.arange(len(y_poison))],
          batch_size=self.batch_size,
      )
  
      return input_noised_, B_
  
file_path: adversarial-robustness-toolbox/art/attacks/poisoning/gradient_matching_attack.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  from typing import Any, Dict, Tuple, TYPE_CHECKING, List
  import numpy
  from tqdm.auto import trange, tqdm
  from art.attacks.attack import Attack
  from art.estimators import BaseEstimator, NeuralNetworkMixin
  from art.estimators.classification.classifier import ClassifierMixin
label_desc: Use image node_id 9 for calling the GradientMatchingAttack obj's underlying member method code with example usage: obj._poison__tensorflow(x_poison, y_poison) and returns: input_noised_,  B_