Created
July 7, 2016 10:03
-
-
Save geogeorgiev/9471e72e001adc9eb65fe3882b6c4c60 to your computer and use it in GitHub Desktop.
Test GPU enabled Tensorflow Docker container
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
for d in ['/gpu:0']: | |
with tf.device(d): | |
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') | |
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b') | |
c = tf.matmul(a, b) | |
# Creates a session with allow_soft_placement and log_device_placement set | |
# to True. | |
sess = tf.Session(config=tf.ConfigProto( | |
allow_soft_placement=True, log_device_placement=True)) | |
# Runs the op. | |
print sess.run(c) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment