Skip to content

Commit 122ce3b

Browse files
author
Beat Buesser
committed
Apply Black formatting
Signed-off-by: Beat Buesser <[email protected]>
1 parent d497303 commit 122ce3b

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

art/attacks/evasion/adversarial_patch/adversarial_patch_tensorflow.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,11 @@ def _random_overlay(self, images: np.ndarray, patch: np.ndarray, scale: Optional
226226
)
227227

228228
image_mask = tf.pad(
229-
image_mask, paddings=tf.constant([[0, 0, ], [0, 0, ], [100, 100], [0, 0]]), mode='CONSTANT',
230-
constant_values=0, name=None
229+
image_mask,
230+
paddings=tf.constant([[0, 0,], [0, 0,], [100, 100], [0, 0]]),
231+
mode="CONSTANT",
232+
constant_values=0,
233+
name=None,
231234
)
232235

233236
image_mask = tf.cast(image_mask, images.dtype)
@@ -251,7 +254,11 @@ def _random_overlay(self, images: np.ndarray, patch: np.ndarray, scale: Optional
251254
pad_h_1 = self.image_shape[1] - smallest_image_edge - pad_h_0
252255

253256
padded_patch = tf.pad(
254-
padded_patch, paddings=tf.constant([[0, 0], [pad_h_0, pad_h_1], [pad_w_0, pad_w_1], [0, 0]]), mode='CONSTANT', constant_values=0, name=None
257+
padded_patch,
258+
paddings=tf.constant([[0, 0], [pad_h_0, pad_h_1], [pad_w_0, pad_w_1], [0, 0]]),
259+
mode="CONSTANT",
260+
constant_values=0,
261+
name=None,
255262
)
256263

257264
padded_patch = tf.cast(padded_patch, images.dtype)
@@ -296,7 +303,9 @@ def _random_overlay(self, images: np.ndarray, patch: np.ndarray, scale: Optional
296303
transform_vectors.append(np.array([a0, a1, a2, b0, b1, b2, 0, 0]).astype(np.float32))
297304

298305
image_mask = tfa.image.transform(image_mask, transform_vectors, "BILINEAR", output_shape=self.image_shape[:2])
299-
padded_patch = tfa.image.transform(padded_patch, transform_vectors, "BILINEAR", output_shape=self.image_shape[:2])
306+
padded_patch = tfa.image.transform(
307+
padded_patch, transform_vectors, "BILINEAR", output_shape=self.image_shape[:2]
308+
)
300309
inverted_mask = 1 - image_mask
301310

302311
return images * inverted_mask + padded_patch * image_mask

0 commit comments

Comments
 (0)