aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/examples/how_tos
diff options
context:
space:
mode:
authorGravatar Yaroslav Bulatov <yaroslavvb@google.com>2016-01-22 16:21:34 -0800
committerGravatar Vijay Vasudevan <vrv@google.com>2016-01-22 17:04:58 -0800
commitebe109b76d3a8fbdfadee8fa1e6e642563c88034 (patch)
treea6c57b76e983fec48b4ed2f45cf4f01fec034f2d /tensorflow/examples/how_tos
parent26d9efa1f0cc87f2ff86eebcec280eec2ab7d511 (diff)
Pin constant holding data to CPU. This makes GPU version 50-100x faster per step. Fixes #837
Change: 112829709
Diffstat (limited to 'tensorflow/examples/how_tos')
-rw-r--r--tensorflow/examples/how_tos/reading_data/fully_connected_preloaded.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tensorflow/examples/how_tos/reading_data/fully_connected_preloaded.py b/tensorflow/examples/how_tos/reading_data/fully_connected_preloaded.py
index 39ce1a759b..93ab4dfdf8 100644
--- a/tensorflow/examples/how_tos/reading_data/fully_connected_preloaded.py
+++ b/tensorflow/examples/how_tos/reading_data/fully_connected_preloaded.py
@@ -65,9 +65,10 @@ def run_training():
# Tell TensorFlow that the model will be built into the default Graph.
with tf.Graph().as_default():
with tf.name_scope('input'):
- # Input data
- input_images = tf.constant(data_sets.train.images)
- input_labels = tf.constant(data_sets.train.labels)
+ # Input data, pin to CPU because rest of pipeline is CPU-only
+ with tf.device('/cpu:0'):
+ input_images = tf.constant(data_sets.train.images)
+ input_labels = tf.constant(data_sets.train.labels)
image, label = tf.train.slice_input_producer(
[input_images, input_labels], num_epochs=FLAGS.num_epochs)