Skip to content

Commit 9f6599c

Browse files
author
Beat Buesser
committed
Apply Black formatting
Signed-off-by: Beat Buesser <[email protected]>
1 parent 13ac04f commit 9f6599c

File tree

2 files changed

+5
-21
lines changed

2 files changed

+5
-21
lines changed

art/attacks/evasion/spatial_transformation.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -118,23 +118,11 @@ def generate(self, x: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> n
118118

119119
grid_trans_x = [
120120
int(round(g))
121-
for g in list(
122-
np.linspace(
123-
-max_num_pixel_trans_x,
124-
max_num_pixel_trans_x,
125-
num=self.num_translations,
126-
)
127-
)
121+
for g in list(np.linspace(-max_num_pixel_trans_x, max_num_pixel_trans_x, num=self.num_translations,))
128122
]
129123
grid_trans_y = [
130124
int(round(g))
131-
for g in list(
132-
np.linspace(
133-
-max_num_pixel_trans_y,
134-
max_num_pixel_trans_y,
135-
num=self.num_translations,
136-
)
137-
)
125+
for g in list(np.linspace(-max_num_pixel_trans_y, max_num_pixel_trans_y, num=self.num_translations,))
138126
]
139127
grid_rot = list(np.linspace(-self.max_rotation, self.max_rotation, num=self.num_rotations))
140128

@@ -187,8 +175,7 @@ def generate(self, x: np.ndarray, y: Optional[np.ndarray] = None, **kwargs) -> n
187175
self.attack_rot = rot
188176

189177
logger.info(
190-
"Success rate of spatial transformation attack: %.2f%%",
191-
100 * self.fooling_rate,
178+
"Success rate of spatial transformation attack: %.2f%%", 100 * self.fooling_rate,
192179
)
193180
logger.info("Attack-translation in x: %.2f%%", self.attack_trans_x)
194181
logger.info("Attack-translation in y: %.2f%%", self.attack_trans_y)
@@ -211,10 +198,7 @@ def _perturb(self, x: np.ndarray, trans_x: int, trans_y: int, rot: float) -> np.
211198

212199
if self.estimator.clip_values is not None:
213200
np.clip(
214-
x_adv,
215-
self.estimator.clip_values[0],
216-
self.estimator.clip_values[1],
217-
out=x_adv,
201+
x_adv, self.estimator.clip_values[0], self.estimator.clip_values[1], out=x_adv,
218202
)
219203

220204
return x_adv

art/attacks/extraction/copycat_cnn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def __init__(
6262
batch_size_query: int = 1,
6363
nb_epochs: int = 10,
6464
nb_stolen: int = 1,
65-
use_probability: bool = False
65+
use_probability: bool = False,
6666
) -> None:
6767
"""
6868
Create a Copycat CNN attack instance.

0 commit comments

Comments
 (0)