added func arguments description
@@ -204,7 +204,7 @@ class FastGradientMethod(Attack):
:param eps: (optional float) attack step size (input variation)
:param ord: (optional) Order of the norm (mimics Numpy).
Possible values: np.inf, 1 or 2.
- :param y: (optional) A placeholder for the model labels. Only provide
+ :param y: (optional) A tensor with the model labels. Only provide
this parameter if you'd like to use true labels when crafting
adversarial samples. Otherwise, model predictions are used as
labels to avoid the "label leaking" effect (explained in this
@@ -235,7 +235,7 @@ class FastGradientMethod(Attack):
:param eps: (optional float) attack step size (input variation)
:param ord: (optional) Order of the norm (mimics Numpy).
Possible values: np.inf, 1 or 2.
- :param y: (optional) A placeholder for the model labels. Only provide
+ :param y: (optional) A tensor with the model labels. Only provide
this parameter if you'd like to use true labels when crafting
adversarial samples. Otherwise, model predictions are used as
labels to avoid the "label leaking" effect (explained in this
@@ -284,6 +284,19 @@ class BasicIterativeMethod(Attack):
self.model = CallableModelWrapper(self.model, 'probs')
def generate(self, x, **kwargs):
+ """
+ Generate symbolic graph for adversarial examples and return.
+ :param x: The model's symbolic inputs.
+ :param eps: (required float) maximum distortion of adversarial example
+ compared to original input
+ :param eps_iter: (required float) step size for each attack iteration
+ :param nb_iter: (required int) Number of attack iterations.
+ :param y: (required) A tensor with the model labels.
+ :param ord: (optional) Order of the norm (mimics Numpy).
+ Possible values: np.inf, 1 or 2.
+ :param clip_min: (optional float) Minimum input component value
+ :param clip_max: (optional float) Maximum input component value
+ """
import tensorflow as tf
# Parse and save attack-specific parameters
@@ -337,7 +350,7 @@ class BasicIterativeMethod(Attack):
compared to original input
:param eps_iter: (required float) step size for each attack iteration
:param nb_iter: (required int) Number of attack iterations.
- :param y: (required) A placeholder for the model labels.
+ :param y: (required) A tensor with the model labels.
:param ord: (optional) Order of the norm (mimics Numpy).
Possible values: np.inf, 1 or 2.
:param clip_min: (optional float) Minimum input component value
@@ -390,7 +403,15 @@ class SaliencyMapMethod(Attack):
def generate(self, x, **kwargs):
"""
- Attack-specific parameters:
+ Generate symbolic graph for adversarial examples and return.
+ :param x: The model's symbolic inputs.
+ :param theta: (optional float) Perturbation introduced to modified
+ components (can be positive or negative)
+ :param gamma: (optional float) Maximum percentage of perturbed features
+ :param nb_classes: (optional int) Number of model output classes
+ :param clip_min: (optional float) Minimum component value for clipping
+ :param clip_max: (optional float) Maximum component value for clipping
+ :param targets: (optional) Target tensor if the attack is targeted
"""
import tensorflow as tf
from .attacks_tf import jacobian_graph, jsma_batch
@@ -437,7 +458,7 @@ class SaliencyMapMethod(Attack):
:param nb_classes: (optional int) Number of model output classes
:param clip_min: (optional float) Minimum component value for clipping
:param clip_max: (optional float) Maximum component value for clipping
- :param targets: (optional) Target placeholder if the attack is targeted
+ :param targets: (optional) Target tensor if the attack is targeted
"""
self.theta = theta
