From 1dac5e7f39ec9884cfc6985e4334bc3ede1fc750 Mon Sep 17 00:00:00 2001 From: Ian Goodfellow Date: Mon, 21 Aug 2017 18:50:04 -0700 Subject: [PATCH 1/2] rename "tutorials" to "cleverhans_tutorials" --- README.md | 10 +++++----- cleverhans/attacks_tf.py | 2 +- cleverhans/devtools/list_files.py | 2 +- {tutorials => cleverhans_tutorials}/__init__.py | 0 {tutorials => cleverhans_tutorials}/mnist_blackbox.py | 0 .../mnist_tutorial_cw.py | 0 .../mnist_tutorial_jsma.py | 0 .../mnist_tutorial_keras_tf.py | 0 .../mnist_tutorial_tf.py | 0 .../mnist_tutorial_th.py | 0 {tutorials => cleverhans_tutorials}/tutorial_models.py | 0 tests_tf/test_mnist_blackbox.py | 2 +- tests_tf/test_mnist_tutorial_cw.py | 2 +- tests_tf/test_mnist_tutorial_jsma.py | 2 +- tests_tf/test_mnist_tutorial_keras_tf.py | 2 +- tests_tf/test_mnist_tutorial_tf.py | 2 +- 16 files changed, 12 insertions(+), 12 deletions(-) rename {tutorials => cleverhans_tutorials}/__init__.py (100%) rename {tutorials => cleverhans_tutorials}/mnist_blackbox.py (100%) rename {tutorials => cleverhans_tutorials}/mnist_tutorial_cw.py (100%) rename {tutorials => cleverhans_tutorials}/mnist_tutorial_jsma.py (100%) rename {tutorials => cleverhans_tutorials}/mnist_tutorial_keras_tf.py (100%) rename {tutorials => cleverhans_tutorials}/mnist_tutorial_tf.py (100%) rename {tutorials => cleverhans_tutorials}/mnist_tutorial_th.py (100%) rename {tutorials => cleverhans_tutorials}/tutorial_models.py (100%) diff --git a/README.md b/README.md index 3a5890d57..d1a6e0adc 100644 --- a/README.md +++ b/README.md @@ -73,20 +73,20 @@ currently [test it](https://travis-ci.org/tensorflow/cleverhans) with Python ## Tutorials To help you get started with the functionalities provided by this library, the -`tutorials/' folder comes with the following tutorials: -* **MNIST with FGSM** ([code](tutorials/mnist_tutorial_tf.py)): this +`cleverhans_tutorials/' folder comes with the following tutorials: +* **MNIST with FGSM** ([code](cleverhans_tutorials/mnist_tutorial_tf.py)): this tutorial covers how to train a MNIST model using TensorFlow, craft adversarial examples using the [fast gradient sign method](https://arxiv.org/abs/1412.6572), and make the model more robust to adversarial examples using adversarial training. -* **MNIST with FGSM using Keras** ([code](tutorials/mnist_tutorial_keras_tf.py)): this +* **MNIST with FGSM using Keras** ([code](cleverhans_tutorials/mnist_tutorial_keras_tf.py)): this tutorial covers how to define a MNIST model with Keras and train it using TensorFlow, craft adversarial examples using the [fast gradient sign method](https://arxiv.org/abs/1412.6572), and make the model more robust to adversarial examples using adversarial training. -* **MNIST with JSMA** ([code](tutorials/mnist_tutorial_jsma.py)): this second +* **MNIST with JSMA** ([code](cleverhans_tutorials/mnist_tutorial_jsma.py)): this second tutorial covers how to define a MNIST model with Keras and train it using TensorFlow and craft adversarial examples using the [Jacobian-based saliency map approach](https://arxiv.org/abs/1511.07528). -* **MNIST using a black-box attack** ([code](tutorials/mnist_blackbox.py)): +* **MNIST using a black-box attack** ([code](cleverhans_tutorials/mnist_blackbox.py)): this tutorial implements the black-box attack described in this [paper](https://arxiv.org/abs/1602.02697). The adversary train a substitute model: a copy that imitates the black-box diff --git a/cleverhans/attacks_tf.py b/cleverhans/attacks_tf.py index fcdcf6886..a3f54f352 100644 --- a/cleverhans/attacks_tf.py +++ b/cleverhans/attacks_tf.py @@ -403,7 +403,7 @@ def jacobian_augmentation(sess, x, X_sub_prev, Y_sub, grads, lmbda, Augment an adversary's substitute training set using the Jacobian of a substitute model to generate new synthetic inputs. See https://arxiv.org/abs/1602.02697 for more details. - See tutorials/mnist_blackbox.py for example use case + See cleverhans_tutorials/mnist_blackbox.py for example use case :param sess: TF session in which the substitute model is defined :param x: input TF placeholder for the substitute model :param X_sub_prev: substitute training data available to the adversary diff --git a/cleverhans/devtools/list_files.py b/cleverhans/devtools/list_files.py index 85792fe94..92cdf5cbc 100644 --- a/cleverhans/devtools/list_files.py +++ b/cleverhans/devtools/list_files.py @@ -32,7 +32,7 @@ def list_files(suffix=""): file_list = _list_files(cleverhans_path, suffix) repo_path = os.path.abspath(os.path.join(cleverhans_path, os.pardir)) - tutorials_path = os.path.join(repo_path, "tutorials") + tutorials_path = os.path.join(repo_path, "cleverhans_tutorials") tutorials_files = _list_files(tutorials_path, suffix) tutorials_files = [os.path.join(os.pardir, path) for path in tutorials_files] diff --git a/tutorials/__init__.py b/cleverhans_tutorials/__init__.py similarity index 100% rename from tutorials/__init__.py rename to cleverhans_tutorials/__init__.py diff --git a/tutorials/mnist_blackbox.py b/cleverhans_tutorials/mnist_blackbox.py similarity index 100% rename from tutorials/mnist_blackbox.py rename to cleverhans_tutorials/mnist_blackbox.py diff --git a/tutorials/mnist_tutorial_cw.py b/cleverhans_tutorials/mnist_tutorial_cw.py similarity index 100% rename from tutorials/mnist_tutorial_cw.py rename to cleverhans_tutorials/mnist_tutorial_cw.py diff --git a/tutorials/mnist_tutorial_jsma.py b/cleverhans_tutorials/mnist_tutorial_jsma.py similarity index 100% rename from tutorials/mnist_tutorial_jsma.py rename to cleverhans_tutorials/mnist_tutorial_jsma.py diff --git a/tutorials/mnist_tutorial_keras_tf.py b/cleverhans_tutorials/mnist_tutorial_keras_tf.py similarity index 100% rename from tutorials/mnist_tutorial_keras_tf.py rename to cleverhans_tutorials/mnist_tutorial_keras_tf.py diff --git a/tutorials/mnist_tutorial_tf.py b/cleverhans_tutorials/mnist_tutorial_tf.py similarity index 100% rename from tutorials/mnist_tutorial_tf.py rename to cleverhans_tutorials/mnist_tutorial_tf.py diff --git a/tutorials/mnist_tutorial_th.py b/cleverhans_tutorials/mnist_tutorial_th.py similarity index 100% rename from tutorials/mnist_tutorial_th.py rename to cleverhans_tutorials/mnist_tutorial_th.py diff --git a/tutorials/tutorial_models.py b/cleverhans_tutorials/tutorial_models.py similarity index 100% rename from tutorials/tutorial_models.py rename to cleverhans_tutorials/tutorial_models.py diff --git a/tests_tf/test_mnist_blackbox.py b/tests_tf/test_mnist_blackbox.py index 2f98cc40b..3cf34d797 100644 --- a/tests_tf/test_mnist_blackbox.py +++ b/tests_tf/test_mnist_blackbox.py @@ -4,7 +4,7 @@ class TestMNISTBlackboxF(unittest.TestCase): def test_mnist_blackbox(self): - from tutorials import mnist_blackbox + from cleverhans_tutorials import mnist_blackbox np.random.seed(42) import tensorflow as tf diff --git a/tests_tf/test_mnist_tutorial_cw.py b/tests_tf/test_mnist_tutorial_cw.py index 04dc09150..e4f754b49 100644 --- a/tests_tf/test_mnist_tutorial_cw.py +++ b/tests_tf/test_mnist_tutorial_cw.py @@ -3,7 +3,7 @@ class TestMNISTTutorialCW(unittest.TestCase): def test_mnist_tutorial_cw(self): - from tutorials import mnist_tutorial_cw + from cleverhans_tutorials import mnist_tutorial_cw # Run the MNIST tutorial on a dataset of reduced size # and disable visualization. diff --git a/tests_tf/test_mnist_tutorial_jsma.py b/tests_tf/test_mnist_tutorial_jsma.py index 3ddb1e903..cf1180b80 100644 --- a/tests_tf/test_mnist_tutorial_jsma.py +++ b/tests_tf/test_mnist_tutorial_jsma.py @@ -9,7 +9,7 @@ def test_mnist_tutorial_jsma(self): import tensorflow as tf tf.set_random_seed(42) - from tutorials import mnist_tutorial_jsma + from cleverhans_tutorials import mnist_tutorial_jsma # Run the MNIST tutorial on a dataset of reduced size # and disable visualization. diff --git a/tests_tf/test_mnist_tutorial_keras_tf.py b/tests_tf/test_mnist_tutorial_keras_tf.py index e2ad568a7..5884e2db2 100644 --- a/tests_tf/test_mnist_tutorial_keras_tf.py +++ b/tests_tf/test_mnist_tutorial_keras_tf.py @@ -9,7 +9,7 @@ def test_mnist_tutorial_keras_tf(self): import tensorflow as tf tf.set_random_seed(42) - from tutorials import mnist_tutorial_keras_tf + from cleverhans_tutorials import mnist_tutorial_keras_tf # Run the MNIST tutorial on a dataset of reduced size test_dataset_indices = {'train_start': 0, diff --git a/tests_tf/test_mnist_tutorial_tf.py b/tests_tf/test_mnist_tutorial_tf.py index f8f849676..6ce5bcfa6 100644 --- a/tests_tf/test_mnist_tutorial_tf.py +++ b/tests_tf/test_mnist_tutorial_tf.py @@ -9,7 +9,7 @@ def test_mnist_tutorial_tf(self): import tensorflow as tf tf.set_random_seed(42) - from tutorials import mnist_tutorial_tf + from cleverhans_tutorials import mnist_tutorial_tf # Run the MNIST tutorial on a dataset of reduced size test_dataset_indices = {'train_start': 0, From ee99cbaf3d566a18787a2c6dcf6d13b98b0e8da8 Mon Sep 17 00:00:00 2001 From: Ian Goodfellow Date: Mon, 21 Aug 2017 19:04:28 -0700 Subject: [PATCH 2/2] missed some renames --- cleverhans_tutorials/mnist_blackbox.py | 4 ++-- cleverhans_tutorials/mnist_tutorial_cw.py | 2 +- cleverhans_tutorials/mnist_tutorial_jsma.py | 2 +- cleverhans_tutorials/mnist_tutorial_tf.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cleverhans_tutorials/mnist_blackbox.py b/cleverhans_tutorials/mnist_blackbox.py index 1ddf95eb2..3ab8e90c1 100644 --- a/cleverhans_tutorials/mnist_blackbox.py +++ b/cleverhans_tutorials/mnist_blackbox.py @@ -18,8 +18,8 @@ from cleverhans.attacks import FastGradientMethod from cleverhans.attacks_tf import jacobian_graph, jacobian_augmentation -from tutorials.tutorial_models import make_basic_cnn, MLP -from tutorials.tutorial_models import Flatten, Linear, ReLU, Softmax +from cleverhans_tutorials.tutorial_models import make_basic_cnn, MLP +from cleverhans_tutorials.tutorial_models import Flatten, Linear, ReLU, Softmax FLAGS = flags.FLAGS diff --git a/cleverhans_tutorials/mnist_tutorial_cw.py b/cleverhans_tutorials/mnist_tutorial_cw.py index c92d771fc..177f6eae3 100644 --- a/cleverhans_tutorials/mnist_tutorial_cw.py +++ b/cleverhans_tutorials/mnist_tutorial_cw.py @@ -16,7 +16,7 @@ from cleverhans.utils import set_log_level from cleverhans.utils_mnist import data_mnist from cleverhans.utils_tf import model_train, model_eval, tf_model_load -from tutorials.tutorial_models import make_basic_cnn +from cleverhans_tutorials.tutorial_models import make_basic_cnn FLAGS = flags.FLAGS diff --git a/cleverhans_tutorials/mnist_tutorial_jsma.py b/cleverhans_tutorials/mnist_tutorial_jsma.py index ab39d4814..8690ca575 100644 --- a/cleverhans_tutorials/mnist_tutorial_jsma.py +++ b/cleverhans_tutorials/mnist_tutorial_jsma.py @@ -16,7 +16,7 @@ from cleverhans.utils_mnist import data_mnist from cleverhans.utils_tf import model_train, model_eval, model_argmax from cleverhans.utils_keras import KerasModelWrapper, cnn_model -from tutorials.tutorial_models import make_basic_cnn +from cleverhans_tutorials.tutorial_models import make_basic_cnn FLAGS = flags.FLAGS diff --git a/cleverhans_tutorials/mnist_tutorial_tf.py b/cleverhans_tutorials/mnist_tutorial_tf.py index 8a6d7af9a..697214d43 100644 --- a/cleverhans_tutorials/mnist_tutorial_tf.py +++ b/cleverhans_tutorials/mnist_tutorial_tf.py @@ -19,7 +19,7 @@ from cleverhans.utils_mnist import data_mnist from cleverhans.utils_tf import model_train, model_eval from cleverhans.attacks import FastGradientMethod -from tutorials.tutorial_models import make_basic_cnn +from cleverhans_tutorials.tutorial_models import make_basic_cnn from cleverhans.utils import AccuracyReport, set_log_level import os