Skip to content

Commit 63c5887

Browse files
Neural-Link Teamtensorflow-copybara
authored andcommitted
Updates the links and TF version in adversarial regularization tutorial.
PiperOrigin-RevId: 266171330
1 parent 41a0e0a commit 63c5887

File tree

1 file changed

+24
-25
lines changed

1 file changed

+24
-25
lines changed

g3doc/tutorials/adversarial_keras_cnn_mnist.ipynb

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"cell_type": "code",
1515
"execution_count": 0,
1616
"metadata": {
17-
"cellView": "both",
17+
"cellView": "form",
1818
"colab": {},
1919
"colab_type": "code",
2020
"id": "nxbcnXODdE06"
@@ -53,13 +53,13 @@
5353
"source": [
5454
"\u003ctable class=\"tfo-notebook-buttons\" align=\"left\"\u003e\n",
5555
" \u003ctd\u003e\n",
56-
" \u003ca target=\"_blank\" href=\"https://www.tensorflow.org/neural_structured_learning/tutorials/adversarial_learning_for_image_classification.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/tf_logo_32px.png\" /\u003eView on TensorFlow.org\u003c/a\u003e\n",
56+
" \u003ca target=\"_blank\" href=\"https://www.tensorflow.org/neural_structured_learning/tutorials/adversarial_keras_cnn_mnist\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/tf_logo_32px.png\" /\u003eView on TensorFlow.org\u003c/a\u003e\n",
5757
" \u003c/td\u003e\n",
5858
" \u003ctd\u003e\n",
59-
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/neural-structured-learning/blob/master/g3doc/tutorials/adversarial_learning_for_image_classification.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
59+
" \u003ca target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/neural-structured-learning/blob/master/g3doc/tutorials/adversarial_keras_cnn_mnist.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" /\u003eRun in Google Colab\u003c/a\u003e\n",
6060
" \u003c/td\u003e\n",
6161
" \u003ctd\u003e\n",
62-
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/neural-structured-learning/blob/master/g3doc/tutorials/adversarial_learning_for_image_classification.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView source on GitHub\u003c/a\u003e\n",
62+
" \u003ca target=\"_blank\" href=\"https://github.com/tensorflow/neural-structured-learning/blob/master/g3doc/tutorials/adversarial_keras_cnn_mnist.ipynb\"\u003e\u003cimg src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" /\u003eView source on GitHub\u003c/a\u003e\n",
6363
" \u003c/td\u003e\n",
6464
"\u003c/table\u003e"
6565
]
@@ -112,10 +112,11 @@
112112
"cell_type": "markdown",
113113
"metadata": {
114114
"colab_type": "text",
115-
"id": "4RhmgQ7-mlrl"
115+
"id": "m58k8nv3YVdf"
116116
},
117117
"source": [
118-
"Install the Neural Structured Learning package."
118+
"Install Tensorflow 2.0 to create an interactive developing environment with\n",
119+
"eager execution."
119120
]
120121
},
121122
{
@@ -124,22 +125,21 @@
124125
"metadata": {
125126
"colab": {},
126127
"colab_type": "code",
127-
"id": "ByJ7133BQULR"
128+
"id": "rYz0BCS_YSD_"
128129
},
129130
"outputs": [],
130131
"source": [
131-
"!pip install --quiet neural-structured-learning"
132+
"!pip install tensorflow==2.0.0-rc0"
132133
]
133134
},
134135
{
135136
"cell_type": "markdown",
136137
"metadata": {
137138
"colab_type": "text",
138-
"id": "PZvsEQrhSqKx"
139+
"id": "4RhmgQ7-mlrl"
139140
},
140141
"source": [
141-
"Import libraries and enable TensorFlow 2.0 behavior (eager execution, etc) to\n",
142-
"create an interactive developing environment."
142+
"Install the Neural Structured Learning package."
143143
]
144144
},
145145
{
@@ -148,28 +148,21 @@
148148
"metadata": {
149149
"colab": {},
150150
"colab_type": "code",
151-
"id": "EuqEuAYzTMo0"
151+
"id": "ByJ7133BQULR"
152152
},
153153
"outputs": [],
154154
"source": [
155-
"from __future__ import absolute_import, division, print_function, unicode_literals\n",
156-
"\n",
157-
"import tensorflow.compat.v2 as tf\n",
158-
"tf.enable_v2_behavior()\n",
159-
"\n",
160-
"import matplotlib.pyplot as plt\n",
161-
"import numpy as np\n",
162-
"import tensorflow_datasets as tfds"
155+
"!pip install --quiet neural-structured-learning"
163156
]
164157
},
165158
{
166159
"cell_type": "markdown",
167160
"metadata": {
168161
"colab_type": "text",
169-
"id": "ZS38zhsCmqCJ"
162+
"id": "PZvsEQrhSqKx"
170163
},
171164
"source": [
172-
"And import the Neural Structured Learning library."
165+
"Import libraries. We abbreviate `neural_structured_learning` to `nsl`."
173166
]
174167
},
175168
{
@@ -178,11 +171,17 @@
178171
"metadata": {
179172
"colab": {},
180173
"colab_type": "code",
181-
"id": "pw3A7K7HSgOO"
174+
"id": "EuqEuAYzTMo0"
182175
},
183176
"outputs": [],
184177
"source": [
185-
"import neural_structured_learning as nsl"
178+
"from __future__ import absolute_import, division, print_function, unicode_literals\n",
179+
"\n",
180+
"import matplotlib.pyplot as plt\n",
181+
"import neural_structured_learning as nsl\n",
182+
"import numpy as np\n",
183+
"import tensorflow as tf\n",
184+
"import tensorflow_datasets as tfds"
186185
]
187186
},
188187
{
@@ -560,7 +559,7 @@
560559
"source": [
561560
"adv_model.compile(optimizer='adam', loss='sparse_categorical_crossentropy',\n",
562561
" metrics=['accuracy'])\n",
563-
"adv_model.fit(train_set_for_adv_model, epochs=5)"
562+
"adv_model.fit(train_set_for_adv_model, epochs=HPARAMS.epochs)"
564563
]
565564
},
566565
{

0 commit comments

Comments
 (0)