class_docstr: This class represent a Feature Adversaries evasion attack in PyTorch.
  
  | Paper link: https://arxiv.org/abs/1511.05122
docstr: Generate adversarial samples and return them in an array.
  
  :param x: Source samples.
  :param y: Guide samples.
  :return: Adversarial examples.
code: def generate(
      self, x: np.ndarray, y: Optional[np.ndarray] = None, **kwargs
  ) -> np.ndarray:
      """
      Generate adversarial samples and return them in an array.
  
      :param x: Source samples.
      :param y: Guide samples.
      :return: Adversarial examples.
      """
      import torch
  
      if y is None:
          raise ValueError(
              "The value of guide `y` cannot be None. Please provide a `np.ndarray` of guide inputs."
          )
      if x.shape != y.shape:
          raise ValueError(
              "The shape of source `x` and guide `y` must be of same shape."
          )
      if x.shape[1:] != self.estimator.input_shape:  # pragma: no cover
          raise ValueError(
              "Source and guide inputs must match `input_shape` of estimator."
          )
  
      nb_samples = x.shape[0]
  
      x_adversarial = [None] * nb_samples
  
      nb_batches = int(np.ceil(nb_samples / float(self.batch_size)))
      for m in range(nb_batches):
          # batch indices
          begin, end = m * self.batch_size, min(
              (m + 1) * self.batch_size, nb_samples
          )
  
          # create batch of adversarial examples
          source_batch = torch.tensor(x[begin:end]).to(
              self.estimator.device
          )
          guide_batch = torch.tensor(y[begin:end]).to(
              self.estimator.device
          )
          x_adversarial[begin:end] = self._generate_batch(
              source_batch, guide_batch
          ).numpy()
      return np.array(x_adversarial, dtype=x.dtype)
  
file_path: adversarial-robustness-toolbox/art/attacks/evasion/feature_adversaries/feature_adversaries_pytorch.py
imports: import logging
  from typing import TYPE_CHECKING, Optional, Tuple, Union
  import numpy
  from tqdm.auto import trange
  from art.attacks.attack import EvasionAttack
  from art.estimators.estimator import BaseEstimator, NeuralNetworkMixin
label_desc: Use image node_id 3 for calling the FeatureAdversariesPyTorch obj's underlying member method code with example usage: obj.generate(x, y) and returns: np