|
14 | 14 | "cell_type": "code", |
15 | 15 | "execution_count": 0, |
16 | 16 | "metadata": { |
17 | | - "cellView": "both", |
| 17 | + "cellView": "form", |
18 | 18 | "colab": {}, |
19 | 19 | "colab_type": "code", |
20 | 20 | "id": "nxbcnXODdE06" |
|
53 | 53 | "source": [ |
54 | 54 | "\u003ctable class=\"tfo-notebook-buttons\" align=\"left\"\u003e\n", |
55 | 55 | " \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", |
57 | 57 | " \u003c/td\u003e\n", |
58 | 58 | " \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", |
60 | 60 | " \u003c/td\u003e\n", |
61 | 61 | " \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", |
63 | 63 | " \u003c/td\u003e\n", |
64 | 64 | "\u003c/table\u003e" |
65 | 65 | ] |
|
112 | 112 | "cell_type": "markdown", |
113 | 113 | "metadata": { |
114 | 114 | "colab_type": "text", |
115 | | - "id": "4RhmgQ7-mlrl" |
| 115 | + "id": "m58k8nv3YVdf" |
116 | 116 | }, |
117 | 117 | "source": [ |
118 | | - "Install the Neural Structured Learning package." |
| 118 | + "Install Tensorflow 2.0 to create an interactive developing environment with\n", |
| 119 | + "eager execution." |
119 | 120 | ] |
120 | 121 | }, |
121 | 122 | { |
|
124 | 125 | "metadata": { |
125 | 126 | "colab": {}, |
126 | 127 | "colab_type": "code", |
127 | | - "id": "ByJ7133BQULR" |
| 128 | + "id": "rYz0BCS_YSD_" |
128 | 129 | }, |
129 | 130 | "outputs": [], |
130 | 131 | "source": [ |
131 | | - "!pip install --quiet neural-structured-learning" |
| 132 | + "!pip install tensorflow==2.0.0-rc0" |
132 | 133 | ] |
133 | 134 | }, |
134 | 135 | { |
135 | 136 | "cell_type": "markdown", |
136 | 137 | "metadata": { |
137 | 138 | "colab_type": "text", |
138 | | - "id": "PZvsEQrhSqKx" |
| 139 | + "id": "4RhmgQ7-mlrl" |
139 | 140 | }, |
140 | 141 | "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." |
143 | 143 | ] |
144 | 144 | }, |
145 | 145 | { |
|
148 | 148 | "metadata": { |
149 | 149 | "colab": {}, |
150 | 150 | "colab_type": "code", |
151 | | - "id": "EuqEuAYzTMo0" |
| 151 | + "id": "ByJ7133BQULR" |
152 | 152 | }, |
153 | 153 | "outputs": [], |
154 | 154 | "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" |
163 | 156 | ] |
164 | 157 | }, |
165 | 158 | { |
166 | 159 | "cell_type": "markdown", |
167 | 160 | "metadata": { |
168 | 161 | "colab_type": "text", |
169 | | - "id": "ZS38zhsCmqCJ" |
| 162 | + "id": "PZvsEQrhSqKx" |
170 | 163 | }, |
171 | 164 | "source": [ |
172 | | - "And import the Neural Structured Learning library." |
| 165 | + "Import libraries. We abbreviate `neural_structured_learning` to `nsl`." |
173 | 166 | ] |
174 | 167 | }, |
175 | 168 | { |
|
178 | 171 | "metadata": { |
179 | 172 | "colab": {}, |
180 | 173 | "colab_type": "code", |
181 | | - "id": "pw3A7K7HSgOO" |
| 174 | + "id": "EuqEuAYzTMo0" |
182 | 175 | }, |
183 | 176 | "outputs": [], |
184 | 177 | "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" |
186 | 185 | ] |
187 | 186 | }, |
188 | 187 | { |
|
560 | 559 | "source": [ |
561 | 560 | "adv_model.compile(optimizer='adam', loss='sparse_categorical_crossentropy',\n", |
562 | 561 | " 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)" |
564 | 563 | ] |
565 | 564 | }, |
566 | 565 | { |
|
0 commit comments