Last active
April 29, 2019 09:32
-
-
Save benman1/424837b7ffb4d27ef700e04b6c8f1be2 to your computer and use it in GitHub Desktop.
test libcudnn - conv2d in tensorflow/keras uses cudnn
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 | |
config=tf.ConfigProto( | |
log_device_placement=True, | |
) | |
sess = tf.Session(config=config) | |
assert tf.test.is_gpu_available() | |
assert tf.test.is_built_with_cuda() | |
op = tf.shape( | |
tf.nn.conv2d(tf.random_normal([1,10,10,10]), | |
tf.random_normal([2,10,10,10]), | |
strides=[1, 2, 2, 1], | |
padding='SAME', | |
use_cudnn_on_gpu=True | |
) | |
) | |
with tf.Session() as sess: | |
result = sess.run(op) | |
print(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment