Skip to content

Commit f3a542b

Browse files
committed
Reset tutorial.ipynb to previous commit.
1 parent abf32e5 commit f3a542b

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

research/gan/tutorial.ipynb

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
},
6767
{
6868
"cell_type": "code",
69-
"execution_count": 2,
69+
"execution_count": null,
7070
"metadata": {},
7171
"outputs": [],
7272
"source": [
@@ -101,6 +101,7 @@
101101
"import numpy as np\n",
102102
"import time\n",
103103
"import functools\n",
104+
"from six.moves import xrange # pylint: disable=redefined-builtin\n",
104105
"\n",
105106
"import tensorflow as tf\n",
106107
"\n",
@@ -1066,14 +1067,20 @@
10661067
}
10671068
],
10681069
"source": [
1070+
"def _get_next(iterable):\n",
1071+
" try:\n",
1072+
" return iterable.next() # Python 2.x.x\n",
1073+
" except AttributeError:\n",
1074+
" return iterable.__next__() # Python 3.x.x\n",
1075+
"\n",
10691076
"# Run inference.\n",
10701077
"predict_input_fn = _get_predict_input_fn(36, NOISE_DIMS)\n",
10711078
"prediction_iterable = gan_estimator.predict(\n",
10721079
" predict_input_fn, hooks=[tf.train.StopAtStepHook(last_step=1)])\n",
1073-
"predictions = [prediction_iterable.next() for _ in xrange(36)]\n",
1080+
"predictions = [_get_next(prediction_iterable) for _ in xrange(36)]\n",
10741081
"\n",
10751082
"try: # Close the predict session.\n",
1076-
" prediction_iterable.next()\n",
1083+
" _get_next(prediction_iterable)\n",
10771084
"except StopIteration:\n",
10781085
" pass\n",
10791086
"\n",
@@ -1889,7 +1896,7 @@
18891896
"assert images_to_eval % cat_dim == 0\n",
18901897
"\n",
18911898
"unstructured_inputs = tf.random_normal([images_to_eval, noise_dims-cont_dim])\n",
1892-
"cat_noise = tf.constant(range(cat_dim) * (images_to_eval // cat_dim))\n",
1899+
"cat_noise = tf.constant(list(range(cat_dim)) * (images_to_eval // cat_dim))\n",
18931900
"cont_noise = tf.random_uniform([images_to_eval, cont_dim], -1.0, 1.0)\n",
18941901
"\n",
18951902
"with tf.variable_scope(infogan_model.generator_scope, reuse=True):\n",

0 commit comments

Comments
 (0)