FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

add tensorflow cudnn test · feibyte/docker-python@2e4e184 · GitHub

Commit 2e4e184

Browse files
committed
add tensorflow cudnn test
1 parent cbadf5c commit 2e4e184

1 file changed

Lines changed: 21 additions & 3 deletions

File tree

‎tests/test_tensorflow.py‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import numpy as np
44
import tensorflow as tf
5+
from tensorflow.contrib.cudnn_rnn import CudnnGRU
56

67
from common import gpu_test
78

@@ -23,6 +24,23 @@ def test_conv2d(self):
2324
with tf.Session() as sess:
2425
result = sess.run(op)
2526
self.assertEqual(4, len(result.shape))
27+
28+
@gpu_test
29+
def test_cudnn_gru(self):
30+
input = tf.random_normal([1,2,2])
31+
32+
gru = CudnnGRU(
33+
num_layers=1,
34+
num_units=1,
35+
input_mode='skip_input',
36+
direction='unidirectional'
37+
)
38+
39+
op = gru(input)
40+
41+
with tf.Session() as sess:
42+
# Will fail if Cudnn is not properly installed
43+
sess.run(op)
2644

2745
@gpu_test
2846
def test_gpu(self):
@@ -31,7 +49,7 @@ def test_gpu(self):
3149
m2 = tf.constant([3.0, 4.0], shape=[2, 1], name='b')
3250
op = tf.matmul(m1, m2)
3351

34-
sess = tf.Session()
35-
result = sess.run(op)
52+
with tf.Session() as sess:
53+
result = sess.run(op)
3654

37-
self.assertEqual(np.array(18, dtype=np.float32, ndmin=2), result)
55+
self.assertEqual(np.array(18, dtype=np.float32, ndmin=2), result)

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL