Skip to content

Commit

Permalink
Merge pull request caicloud#58 from codercuixin/master
Browse files Browse the repository at this point in the history
Update 2. 改造后的mnist_train.ipynb
  • Loading branch information
perhapszzy authored Jul 18, 2017
2 parents 5368b8d + 8605e58 commit c2d5c04
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
" # 训练模型。\n",
" with tf.Session() as sess:\n",
" tf.global_variables_initializer().run()\n",
" writer = tf.summary.FileWriter(\"/log/modified_mnist_train.log\", tf.get_default_graph())\n",
" for i in range(TRAINING_STEPS):\n",
" xs, ys = mnist.train.next_batch(BATCH_SIZE)\n",
"\n",
Expand All @@ -98,13 +99,14 @@
" _, loss_value, step = sess.run(\n",
" [train_op, loss, global_step], feed_dict={x: xs, y_: ys},\n",
" options=run_options, run_metadata=run_metadata)\n",
" writer.add_run_metadata(run_metadata=run_metadata, tag=(\"tag%d\"%i), global_step=i),
" print(\"After %d training step(s), loss on training batch is %g.\" % (step, loss_value))\n",
" else:\n",
" _, loss_value, step = sess.run([train_op, loss, global_step], feed_dict={x: xs, y_: ys})\n",
"\n",
"\n",
" writer = tf.summary.FileWriter(\"/log/modified_mnist_train.log\", tf.get_default_graph())\n",
" writer.close()"
"
" writer.close()"
]
},
{
Expand Down

0 comments on commit c2d5c04

Please sign in to comment.