Skip to content

Commit a06edfb

Browse files
committed
Resolving pylint and flake errors
Signed-off-by: Shriti Priya <[email protected]>
1 parent c295862 commit a06edfb

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

art/attacks/poisoning/sleeper_agent_attack.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ def __init__(
7373
7474
:param classifier: The proxy classifier used for the attack.
7575
:param percent_poison: The ratio of samples to poison among x_train, with range [0,1].
76-
:indices_target: The indices of training data having target label.
76+
:param patch: The patch to be applied as trigger.
77+
:param indices_target: The indices of training data having target label.
7778
:param epsilon: The L-inf perturbation budget.
7879
:param max_trials: The maximum number of restarts to optimize the poison.
7980
:param max_epochs: The maximum number of epochs to optimize the train per trial.
@@ -83,14 +84,14 @@ def __init__(
8384
:param batch_size: Batch size.
8485
:param clip_values: The range of the input features to the classifier.
8586
:param verbose: Show progress bars.
86-
:patching_strategy: Patching strategy to be used for adding trigger, either random/fixed.
87-
:selection_strategy: Selection strategy for getting the indices of
87+
:param patching_strategy: Patching strategy to be used for adding trigger, either random/fixed.
88+
:param selection_strategy: Selection strategy for getting the indices of
8889
poison examples - either random/maximum gradient norm.
89-
:retraining_factor: The factor for which retraining needs to be applied.
90-
:model_retrain: True, if retraining has to be applied, else False.
91-
:model_retraining_epoch: The epochs for which retraining has to be applied.
92-
:patch: The patch to be applied as trigger.
93-
:K: Number of training samples belonging to target class selected for poisoning.
90+
:param retraining_factor: The factor for which retraining needs to be applied.
91+
:param model_retrain: True, if retraining has to be applied, else False.
92+
:param model_retraining_epoch: The epochs for which retraining has to be applied.
93+
:param class_source: The source class from which triggers were selected.
94+
:param class_target: The target label to which the poisoned model needs to misclassify.
9495
"""
9596
super().__init__(
9697
classifier,
@@ -140,8 +141,6 @@ def poison( # type: ignore
140141

141142
x_train_target_samples, y_train_target_samples = self.select_target_train_samples(x_train, y_train)
142143
if isinstance(self.substitute_classifier, PyTorchClassifier):
143-
import torch
144-
145144
poisoner = self._poison__pytorch
146145
finish_poisoning = self._finish_poison_pytorch
147146
initializer = self._initialize_poison_pytorch

0 commit comments

Comments
 (0)