Skip to content

Commit 50e6b8c

Browse files
author
Beat Buesser
committed
Fix docs build
Signed-off-by: Beat Buesser <[email protected]>
1 parent dc397be commit 50e6b8c

File tree

9 files changed

+50
-26
lines changed

9 files changed

+50
-26
lines changed

art/attacks/evasion/shapeshifter.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from collections import Callable
2626

2727
import numpy as np
28-
import tensorflow as tf
2928

3029
from art.attacks.attack import EvasionAttack
3130
from art.estimators.object_detection.tensorflow_faster_rcnn import TensorFlowFasterRCNN
@@ -344,6 +343,8 @@ def _attack_training(
344343
345344
:return: Adversarial image/texture.
346345
"""
346+
import tensorflow as tf
347+
347348
# Initialize session
348349
self.estimator.sess.run(tf.global_variables_initializer())
349350
self.estimator.sess.run(tf.local_variables_initializer())
@@ -442,6 +443,8 @@ def _build_graph(
442443
:param rendering_function: A rendering function to use textures as input.
443444
:return: A tuple of tensors.
444445
"""
446+
import tensorflow as tf
447+
445448
# Create a placeholder to pass input image/texture
446449
initial_input = tf.placeholder(dtype=tf.float32, shape=initial_shape, name="initial_input")
447450

@@ -628,6 +631,8 @@ def _create_optimizer(self) -> "Optimizer":
628631
629632
:return: Attack optimizer.
630633
"""
634+
import tensorflow as tf
635+
631636
# Create placeholder for learning rate
632637
learning_rate = tf.placeholder(dtype=tf.float32, shape=[], name="learning_rate")
633638

@@ -664,6 +669,8 @@ def _create_attack_loss(
664669
:param custom_loss: Custom loss function from users.
665670
:return: Attack loss tensor.
666671
"""
672+
import tensorflow as tf
673+
667674
# Compute faster rcnn loss
668675
partial_faster_rcnn_loss = self._create_faster_rcnn_loss()
669676

@@ -697,6 +704,8 @@ def _create_faster_rcnn_loss(self) -> "Tensor":
697704
698705
:return: Attack partial loss tensor.
699706
"""
707+
import tensorflow as tf
708+
700709
# Compute RPN classifier loss
701710
rpn_classifier_weight = tf.placeholder(dtype=tf.float32, shape=[], name="rpn_classifier_weight")
702711

@@ -748,6 +757,8 @@ def _create_box_loss(self) -> "Tensor":
748757
749758
:return: Attack partial loss tensor.
750759
"""
760+
import tensorflow as tf
761+
751762
# Get default graph
752763
default_graph = tf.get_default_graph()
753764

@@ -826,6 +837,8 @@ def _create_rpn_loss(self) -> "Tensor":
826837
827838
:return: Attack partial loss tensor.
828839
"""
840+
import tensorflow as tf
841+
829842
# Get default graph
830843
default_graph = tf.get_default_graph()
831844

@@ -888,6 +901,8 @@ def _create_similarity_loss(initial_input: "Tensor", current_value: "Tensor") ->
888901
:param current_value: Current image/texture.
889902
:return: Attack partial loss tensor.
890903
"""
904+
import tensorflow as tf
905+
891906
# Create a placeholder for the similarity weight
892907
similarity_weight = tf.placeholder(dtype=tf.float32, shape=[], name="similarity_weight")
893908

art/estimators/object_detection/tensorflow_faster_rcnn.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ def __init__(
100100
`first_stage_localization_loss`, `first_stage_objectness_loss`,
101101
`second_stage_localization_loss`, `second_stage_classification_loss`.
102102
"""
103+
import tensorflow as tf
103104

104105
# Super initialization
105106
super().__init__(

docs/index.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ Supported Machine Learning Libraries
6666
modules/attacks/poisoning
6767
modules/defences
6868
modules/defences/detector_evasion
69-
modules/defences/detector_poison
69+
modules/defences/detector_evasion_subsetscanning
70+
modules/defences/detector_poisoning
7071
modules/defences/postprocessor
7172
modules/defences/preprocessor
7273
modules/defences/trainer
73-
modules/defences/transformer
74+
modules/defences/transformer_evasion
75+
modules/defences/transformer_poisoning
7476
modules/estimators
7577
modules/estimators/certification
7678
modules/estimators/certification_neural_cleanse

docs/modules/defences/detector_evasion.rst

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,3 @@ Binary Activation Detector
1111
--------------------------
1212
.. autoclass:: BinaryActivationDetector
1313
:members:
14-
15-
Subset Scanning Detector
16-
------------------------
17-
.. autoclass:: SubsetScanningDetector
18-
:members:
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:mod:`art.defences.detector.evasion.subsetscanning`
2+
===================================================
3+
.. automodule:: art.defences.detector.evasion.subsetscanning
4+
5+
Subset Scanning Detector
6+
------------------------
7+
.. autoclass:: SubsetScanningDetector
8+
:members:

docs/modules/defences/detector_poison.rst renamed to docs/modules/defences/detector_poisoning.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
:mod:`art.defences.detector.poison`
2-
===================================
3-
.. automodule:: art.defences.detector.poison
1+
:mod:`art.defences.detector.poisoning`
2+
======================================
3+
.. automodule:: art.defences.detector.poisoning
44

55
Base Class
66
----------

docs/modules/defences/transformer.rst

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:mod:`art.defences.transformer.evasion`
2+
=======================================
3+
.. automodule:: art.defences.transformer.evasion
4+
5+
Defensive Distillation
6+
----------------------
7+
.. autoclass:: DefensiveDistillation
8+
:members:
9+
:special-members:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
:mod:`art.defences.transformer.poisoning`
2+
=========================================
3+
.. automodule:: art.defences.transformer.poisoning
4+
5+
Neural Cleanse
6+
--------------
7+
.. autoclass:: NeuralCleanse
8+
:members:
9+
:special-members:

0 commit comments

Comments
 (0)