Skip to content

Instantly share code, notes, and snippets.

@benman1
Last active April 29, 2019 09:32
Show Gist options
  • Save benman1/424837b7ffb4d27ef700e04b6c8f1be2 to your computer and use it in GitHub Desktop.
Save benman1/424837b7ffb4d27ef700e04b6c8f1be2 to your computer and use it in GitHub Desktop.
test libcudnn - conv2d in tensorflow/keras uses cudnn
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