class_docstr: Close implementation of Feature Collision Poisoning Attack by Shafahi, Huang, et al 2018.
  "Poison Frogs! Targeted Clean-Label Poisoning Attacks on Neural Networks"
  
  This implementation dynamically calculates the dimension of the feature layer, and doesn't hardcode this
  value to 2048 as done in the paper. Thus we recommend using larger values for the similarity_coefficient.
  
  | Paper link: https://arxiv.org/abs/1804.00792
class_docstr_tok: ["Close","implementation","of","Feature","Collision","Poisoning","Attack","by","Shafahi",",","Huang",",","et","al","2018",".","``","Poison","Frogs","!","Targeted","Clean-Label","Poisoning","Attacks","on","Neural","Networks","''","This","implementation","dynamically","calculates","the","dimension","of","the","feature","layer",",","and","does","n't","hardcode","this","value","to","2048","as","done","in","the","paper",".","Thus","we","recommend","using","larger","values","for","the","similarity_coefficient",".","|","Paper","link",":","https",":","\/\/arxiv.org\/abs\/1804.00792"]
docstr: Forward part of forward-backward splitting algorithm.
  
  :param poison: the current poison samples.
  :return: poison example closer in feature representation to target space.
docstr_tok: ["Forward","part","of","forward-backward","splitting","algorithm",".",":","param","poison",":","the","current","poison","samples",".",":","return",":","poison","example","closer","in","feature","representation","to","target","space","."]
code: def forward_step(self, poison: np.ndarray) -> np.ndarray:
      """
      Forward part of forward-backward splitting algorithm.
  
      :param poison: the current poison samples.
      :return: poison example closer in feature representation to target space.
      """
      if isinstance(self.estimator, KerasClassifier):
          (attack_grad,) = self.estimator.custom_loss_gradient(
              self.attack_loss,
              [self.poison_placeholder, self.target_placeholder],
              [poison, self.target],
              name="feature_collision_" + str(self.feature_layer),
          )
      elif isinstance(self.estimator, PyTorchClassifier):
          attack_grad = self.estimator.custom_loss_gradient(
              self.attack_loss, poison, self.target, self.feature_layer
          )
      else:
          raise ValueError(
              "The type of the estimator is not supported."
          )
  
      poison -= self.learning_rate * attack_grad[0]
  
      return poison
  
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  from functools import reduce
  import logging
  from typing import Optional, Tuple, Union, TYPE_CHECKING
  import numpy
  from tqdm.auto import trange
  from art.attacks.attack import PoisoningAttackWhiteBox
  from art.estimators import BaseEstimator, NeuralNetworkMixin
  from art.estimators.classification.classifier import ClassifierMixin
  from art.estimators.classification.keras import KerasClassifier
  from art.estimators.classification.pytorch import PyTorchClassifier
label_desc: Use image node_id 3 for calling the FeatureCollisionAttack obj's underlying member method code with example usage: obj.forward_step(poison) and returns: poison