diff options
author | Manjunath Kudlur <keveman@gmail.com> | 2015-11-06 16:27:58 -0800 |
---|---|---|
committer | Manjunath Kudlur <keveman@gmail.com> | 2015-11-06 16:27:58 -0800 |
commit | f41959ccb2d9d4c722fe8fc3351401d53bcf4900 (patch) | |
tree | ef0ca22cb2a5ac4bdec9d080d8e0788a53ed496d /tensorflow/python/kernel_tests/unique_op_test.py |
TensorFlow: Initial commit of TensorFlow library.
TensorFlow is an open source software library for numerical computation
using data flow graphs.
Base CL: 107276108
Diffstat (limited to 'tensorflow/python/kernel_tests/unique_op_test.py')
-rw-r--r-- | tensorflow/python/kernel_tests/unique_op_test.py | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tensorflow/python/kernel_tests/unique_op_test.py b/tensorflow/python/kernel_tests/unique_op_test.py new file mode 100644 index 0000000000..4d6543a206 --- /dev/null +++ b/tensorflow/python/kernel_tests/unique_op_test.py @@ -0,0 +1,22 @@ +"""Tests for tensorflow.kernels.unique_op.""" +import tensorflow.python.platform + +import numpy as np +import tensorflow as tf + + +class UniqueTest(tf.test.TestCase): + + def testInt32(self): + x = list(np.random.randint(2, high=10, size=7000)) + with self.test_session() as sess: + y, idx = tf.unique(x) + tf_y, tf_idx = sess.run([y, idx]) + + self.assertEqual(len(x), len(tf_idx)) + self.assertEqual(len(tf_y), len(np.unique(x))) + for i in range(len(x)): + self.assertEqual(x[i], tf_y[tf_idx[i]]) + +if __name__ == "__main__": + tf.test.main() |