File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed
art/attacks/evasion/adversarial_patch Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 26
26
import logging
27
27
import math
28
28
from packaging .version import parse
29
- from typing import Any , TYPE_CHECKING
29
+ from typing import Any , cast , TYPE_CHECKING
30
30
31
31
import numpy as np
32
32
from tqdm .auto import trange
@@ -513,13 +513,15 @@ def generate( # type: ignore
513
513
514
514
if hasattr (self .estimator , "nb_classes" ):
515
515
516
+ y_array : np .ndarray
517
+
516
518
if y is None : # pragma: no cover
517
519
logger .info ("Setting labels to estimator classification predictions." )
518
- y_array : np . ndarray = to_categorical (
520
+ y_array = to_categorical (
519
521
np .argmax (self .estimator .predict (x = x ), axis = 1 ), nb_classes = self .estimator .nb_classes
520
522
)
521
523
else :
522
- y_array : np .ndarray = y
524
+ y_array = cast ( np .ndarray , y )
523
525
524
526
y = check_and_transform_label_format (labels = y_array , nb_classes = self .estimator .nb_classes )
525
527
You can’t perform that action at this time.
0 commit comments