Replacing deprecated initialiser function with the new one (#41)

This commit is contained in:
Shadab Shaikh 2017-02-05 22:43:24 +05:30 committed by Donne Martin
parent 62f06d25d7
commit a238b141f3
8 changed files with 37 additions and 37 deletions

View File

@ -230,7 +230,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Initializing the variables\n", "# Initializing the variables\n",
"init = tf.initialize_all_variables()" "init = tf.global_variables_initializer()"
] ]
}, },
{ {
@ -337,7 +337,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython2",
"version": "2.7.5+" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -213,7 +213,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Initializing the variables\n", "# Initializing the variables\n",
"init = tf.initialize_all_variables()" "init = tf.global_variables_initializer()"
] ]
}, },
{ {
@ -313,7 +313,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython2",
"version": "2.7.5+" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -165,7 +165,7 @@
"outputs": [], "outputs": [],
"source": [ "source": [
"# Initializing the variables\n", "# Initializing the variables\n",
"init = tf.initialize_all_variables()" "init = tf.global_variables_initializer()"
] ]
}, },
{ {
@ -231,21 +231,21 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 2",
"language": "python", "language": "python",
"name": "python3" "name": "python2"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 3 "version": 2
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython2",
"version": "3.4.3" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -236,7 +236,7 @@
], ],
"source": [ "source": [
"# Initializing the variables\n", "# Initializing the variables\n",
"init = tf.initialize_all_variables()\n", "init = tf.global_variables_initializer()\n",
"\n", "\n",
"# Launch the graph\n", "# Launch the graph\n",
"with tf.Session() as sess:\n", "with tf.Session() as sess:\n",
@ -286,7 +286,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython2", "pygments_lexer": "ipython2",
"version": "2.7.5+" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -381,7 +381,7 @@
" # This is a one-time operation which ensures the parameters get initialized as\n", " # This is a one-time operation which ensures the parameters get initialized as\n",
" # we described in the graph: random weights for the matrix, zeros for the\n", " # we described in the graph: random weights for the matrix, zeros for the\n",
" # biases. \n", " # biases. \n",
" tf.initialize_all_variables().run()\n", " tf.global_variables_initializer().run()\n",
" print 'Initialized'\n", " print 'Initialized'\n",
" for step in xrange(num_steps):\n", " for step in xrange(num_steps):\n",
" # Run the computations. We tell .run() that we want to run the optimizer,\n", " # Run the computations. We tell .run() that we want to run the optimizer,\n",
@ -544,7 +544,7 @@
"num_steps = 3001\n", "num_steps = 3001\n",
"\n", "\n",
"with tf.Session(graph=graph) as session:\n", "with tf.Session(graph=graph) as session:\n",
" tf.initialize_all_variables().run()\n", " tf.global_variables_initializer().run()\n",
" print \"Initialized\"\n", " print \"Initialized\"\n",
" for step in xrange(num_steps):\n", " for step in xrange(num_steps):\n",
" # Pick an offset within the training data, which has been randomized.\n", " # Pick an offset within the training data, which has been randomized.\n",
@ -589,21 +589,21 @@
"colab_default_view": {}, "colab_default_view": {},
"colab_views": {}, "colab_views": {},
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 2",
"language": "python", "language": "python",
"name": "python3" "name": "python2"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 3 "version": 2
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython2",
"version": "3.4.3" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -412,7 +412,7 @@
"num_steps = 1001\n", "num_steps = 1001\n",
"\n", "\n",
"with tf.Session(graph=graph) as session:\n", "with tf.Session(graph=graph) as session:\n",
" tf.initialize_all_variables().run()\n", " tf.global_variables_initializer().run()\n",
" print \"Initialized\"\n", " print \"Initialized\"\n",
" for step in xrange(num_steps):\n", " for step in xrange(num_steps):\n",
" offset = (step * batch_size) % (train_labels.shape[0] - batch_size)\n", " offset = (step * batch_size) % (train_labels.shape[0] - batch_size)\n",
@ -467,21 +467,21 @@
"colab_default_view": {}, "colab_default_view": {},
"colab_views": {}, "colab_views": {},
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 2",
"language": "python", "language": "python",
"name": "python3" "name": "python2"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 3 "version": 2
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython2",
"version": "3.4.3" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -744,7 +744,7 @@
"num_steps = 100001\n", "num_steps = 100001\n",
"\n", "\n",
"with tf.Session(graph=graph) as session:\n", "with tf.Session(graph=graph) as session:\n",
" tf.initialize_all_variables().run()\n", " tf.global_variables_initializer().run()\n",
" print \"Initialized\"\n", " print \"Initialized\"\n",
" average_loss = 0\n", " average_loss = 0\n",
" for step in xrange(num_steps):\n", " for step in xrange(num_steps):\n",
@ -867,21 +867,21 @@
"colab_default_view": {}, "colab_default_view": {},
"colab_views": {}, "colab_views": {},
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 2",
"language": "python", "language": "python",
"name": "python3" "name": "python2"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 3 "version": 2
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython2",
"version": "3.4.3" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,

View File

@ -928,7 +928,7 @@
"summary_frequency = 100\n", "summary_frequency = 100\n",
"\n", "\n",
"with tf.Session(graph=graph) as session:\n", "with tf.Session(graph=graph) as session:\n",
" tf.initialize_all_variables().run()\n", " tf.global_variables_initializer().run()\n",
" print 'Initialized'\n", " print 'Initialized'\n",
" mean_loss = 0\n", " mean_loss = 0\n",
" for step in xrange(num_steps):\n", " for step in xrange(num_steps):\n",
@ -1042,21 +1042,21 @@
"colab_default_view": {}, "colab_default_view": {},
"colab_views": {}, "colab_views": {},
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 2",
"language": "python", "language": "python",
"name": "python3" "name": "python2"
}, },
"language_info": { "language_info": {
"codemirror_mode": { "codemirror_mode": {
"name": "ipython", "name": "ipython",
"version": 3 "version": 2
}, },
"file_extension": ".py", "file_extension": ".py",
"mimetype": "text/x-python", "mimetype": "text/x-python",
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython2",
"version": "3.4.3" "version": "2.7.12"
} }
}, },
"nbformat": 4, "nbformat": 4,