============================= test session starts ============================== platform linux -- Python 3.5.2, pytest-3.3.1, py-1.5.2, pluggy-0.6.0 -- /usr/bin/python3 cachedir: .cache rootdir: /home/karl/github.com/hughperkins/tf-coriander, inifile: pytest.ini plugins: pep8-1.0.6 collecting ... collected 82 items tensorflow/stream_executor/cl/test/test_binary_ops.py::test[uint8-div-a / b] xfail [ 1%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[uint8-mul-a * b] xfail [ 2%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-not_equal-np.not_equal(a, b)] PASSED [ 3%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-div-a / b] PASSED [ 4%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-sub-a - b] FAILED [ 6%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-pow-np.power(a,b)] FAILED [ 7%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-minimum-np.minimum(a,b)] FAILED [ 8%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-squared_difference-(a - b) * (a - b)] FAILED [ 9%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-maximum-np.maximum(a,b)] FAILED [ 10%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-add-a + b] PASSED [ 12%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-mul-a * b] FAILED [ 13%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[int32-div-a / b] PASSED [ 14%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[int32-sub-a - b] PASSED [ 15%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[int32-minimum-np.minimum(a,b)] PASSED [ 17%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[int32-squared_difference-(a - b) * (a - b)] PASSED [ 18%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[int32-maximum-np.maximum(a,b)] PASSED [ 19%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[int32-add-a + b] PASSED [ 20%] tensorflow/stream_executor/cl/test/test_binary_ops.py::test[int32-mul-a * b] PASSED [ 21%] tensorflow/stream_executor/cl/test/test_blas.py::test_blas PASSED [ 23%] tensorflow/stream_executor/cl/test/test_gradients.py::test_gradients PASSED [ 24%] tensorflow/stream_executor/cl/test/test_loss.py::test_cross_entropy PASSED [ 25%] tensorflow/stream_executor/cl/test/test_misc.py::test_indexing FAILED [ 26%] tensorflow/stream_executor/cl/test/test_misc.py::test_slice PASSED [ 28%] tensorflow/stream_executor/cl/test/test_misc.py::test_strided_slice PASSED [ 29%] tensorflow/stream_executor/cl/test/test_misc.py::test_concat PASSED [ 30%] tensorflow/stream_executor/cl/test/test_misc.py::test_concat2 PASSED [ 31%] tensorflow/stream_executor/cl/test/test_misc.py::test_pack[shape0] PASSED [ 32%] tensorflow/stream_executor/cl/test/test_misc.py::test_pack[shape1] PASSED [ 34%] tensorflow/stream_executor/cl/test/test_misc.py::test_pack[shape2] PASSED [ 35%] tensorflow/stream_executor/cl/test/test_misc.py::test_split FAILED [ 36%] tensorflow/stream_executor/cl/test/test_nn.py::test_relu PASSED [ 37%] tensorflow/stream_executor/cl/test/test_random.py::test_random_normal[shape0] PASSED [ 39%] tensorflow/stream_executor/cl/test/test_random.py::test_random_normal[shape1] PASSED [ 40%] tensorflow/stream_executor/cl/test/test_random.py::test_random_uniform[shape0] PASSED [ 41%] tensorflow/stream_executor/cl/test/test_random.py::test_random_uniform[shape1] PASSED [ 42%] tensorflow/stream_executor/cl/test/test_random.py::test_truncated_normal[shape0] SKIPPED [ 43%] tensorflow/stream_executor/cl/test/test_random.py::test_truncated_normal[shape1] SKIPPED [ 45%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_mean-np.mean-0-tf.float32-shape0] FAILED [ 46%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_mean-np.mean-1-tf.float32-shape1] PASSED [ 47%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_mean-np.mean-None-tf.float32-shape2] FAILED [ 48%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_prod-np.prod-0-tf.float32-shape3] FAILED [ 50%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_prod-np.prod-1-tf.float32-shape4] PASSED [ 51%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_prod-np.prod-None-tf.float32-shape5] FAILED [ 52%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_min-np.min-0-tf.float32-shape6] FAILED [ 53%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_min-np.min-1-tf.float32-shape7] FAILED [ 54%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_min-np.min-None-tf.float32-shape8] PASSED [ 56%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_sum-np.sum-0-tf.float32-shape9] PASSED [ 57%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_sum-np.sum-1-tf.float32-shape10] PASSED [ 58%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_sum-np.sum-None-tf.float32-shape11] PASSED [ 59%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_max-np.max-0-tf.float32-shape12] PASSED [ 60%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_max-np.max-1-tf.float32-shape13] PASSED [ 62%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_max-np.max-None-tf.float32-shape14] PASSED [ 63%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_prod-np.prod-0-tf.int32-shape15] PASSED [ 64%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_prod-np.prod-None-tf.int32-shape16] PASSED [ 65%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_min-np.min-0-tf.int32-shape17] PASSED [ 67%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_min-np.min-1-tf.int32-shape18] PASSED [ 68%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_min-np.min-None-tf.int32-shape19] PASSED [ 69%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_sum-np.sum-0-tf.int32-shape20] PASSED [ 70%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_sum-np.sum-1-tf.int32-shape21] PASSED [ 71%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_sum-np.sum-None-tf.int32-shape22] PASSED [ 73%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_max-np.max-0-tf.int32-shape23] PASSED [ 74%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_max-np.max-1-tf.int32-shape24] PASSED [ 75%] tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_max-np.max-None-tf.int32-shape25] PASSED [ 76%] tensorflow/stream_executor/cl/test/test_simple.py::test_simple PASSED [ 78%] tensorflow/stream_executor/cl/test/test_softmax.py::test_softmax[size0] PASSED [ 79%] tensorflow/stream_executor/cl/test/test_softmax.py::test_softmax[size1] PASSED [ 80%] tensorflow/stream_executor/cl/test/test_softmax.py::test_softmax[size2] PASSED [ 81%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-log-np.log(a)] PASSED [ 82%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-ceil-np.ceil(a)] PASSED [ 84%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-exp-np.exp(a)] PASSED [ 85%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-floor-np.floor(a)] PASSED [ 86%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-square-np.square(a)] PASSED [ 87%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-argmin-np.argmin(a, 1)] PASSED [ 89%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-neg-np.negative(a)] PASSED [ 90%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-sqrt-np.sqrt(a)] PASSED [ 91%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-tanh-np.tanh(a)] PASSED [ 92%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-argmax-np.argmax(a, 1)] PASSED [ 93%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-sigmoid-1/(1+np.exp(-a))] PASSED [ 95%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[float32-abs-np.abs(a)] PASSED [ 96%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[int32-square-np.square(a)] PASSED [ 97%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[int32-neg-np.negative(a)] PASSED [ 98%] tensorflow/stream_executor/cl/test/test_unary_ops.py::test[int32-abs-np.abs(a)] PASSED [100%] generated xml file: /home/karl/github.com/hughperkins/tf-coriander/test/junit-pytest-report.xml =========================== short test summary info ============================ FAIL tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-sub-a - b] FAIL tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-pow-np.power(a,b)] FAIL tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-minimum-np.minimum(a,b)] FAIL tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-squared_difference-(a - b) * (a - b)] FAIL tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-maximum-np.maximum(a,b)] FAIL tensorflow/stream_executor/cl/test/test_binary_ops.py::test[float32-mul-a * b] FAIL tensorflow/stream_executor/cl/test/test_misc.py::test_indexing FAIL tensorflow/stream_executor/cl/test/test_misc.py::test_split FAIL tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_mean-np.mean-0-tf.float32-shape0] FAIL tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_mean-np.mean-None-tf.float32-shape2] FAIL tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_prod-np.prod-0-tf.float32-shape3] FAIL tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_prod-np.prod-None-tf.float32-shape5] FAIL tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_min-np.min-0-tf.float32-shape6] FAIL tensorflow/stream_executor/cl/test/test_reductions.py::test[reduce_min-np.min-1-tf.float32-shape7] SKIP [2] tensorflow/stream_executor/cl/test/test_random.py:56: Causes abort currently XFAIL tensorflow/stream_executor/cl/test/test_binary_ops.py::test[uint8-div-a / b] XFAIL tensorflow/stream_executor/cl/test/test_binary_ops.py::test[uint8-mul-a * b] =================================== FAILURES =================================== ___________________________ test[float32-sub-a - b] ____________________________ dtype = 'float32', tf_func = 'sub', py_func = 'a - b' @pytest.mark.parametrize( 'dtype,tf_func,py_func', [d['mark']((d['dtype'], d['tf_func'], d['py_func'])) for d in get_test_funcs()]) def test(dtype, tf_func, py_func): print('func', tf_func, dtype) np_dtype = eval('np.%s' % dtype) tf_dtype = eval('tf.%s' % dtype) with tf.Graph().as_default(): with tf.Session(config=tf.ConfigProto(log_device_placement=False)) as sess: with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_dtype, [None, None], 'a') tf_b = tf.placeholder(tf_dtype, [None, None], 'b') tf_c = tf.__dict__[tf_func](tf_a, tf_b, name="c") np.random.seed(123) shape = (1, 10) a = np.random.choice(50, shape) / 25 b = np.random.choice(50, shape) / 25 if 'int' in dtype: a *= 10 b *= 10 a = a.astype(np_dtype) b = b.astype(np_dtype) ar, br, cr = sess.run((tf_a, tf_b, tf_c), {tf_a: a, tf_b: b}) print('a', ar) print('b', br) c_py = eval(py_func).astype(np_dtype) print('expected', c_py) print('gpu', cr) diff = np.abs(c_py - cr).max() print('diff', diff) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for sub E assert 1.6296794e+23 < 0.0001 tensorflow/stream_executor/cl/test/test_binary_ops.py:77: AssertionError ----------------------------- Captured stdout call ----------------------------- func sub float32 a [[ 1.79999995 0.08 1.12 1.36000001 1.51999998 0.68000001 0.75999999 1.67999995 0.88 1.32000005]] b [[ 1.27999997 1.96000004 1.88 0.36000001 1.27999997 1.84000003 1.27999997 1.88 1. 0.75999999]] expected [[ 0.51999998 -1.88 -0.75999999 1. 0.24000001 -1.16000009 -0.51999998 -0.20000005 -0.12 0.56000006]] gpu [[ -2.95498072e-35 -2.95498072e-35 1.62967941e+23 1.62967941e+23 -2.95498072e-35 -2.95498072e-35 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23]] diff 1.62968e+23 ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) _______________________ test[float32-pow-np.power(a,b)] ________________________ dtype = 'float32', tf_func = 'pow', py_func = 'np.power(a,b)' @pytest.mark.parametrize( 'dtype,tf_func,py_func', [d['mark']((d['dtype'], d['tf_func'], d['py_func'])) for d in get_test_funcs()]) def test(dtype, tf_func, py_func): print('func', tf_func, dtype) np_dtype = eval('np.%s' % dtype) tf_dtype = eval('tf.%s' % dtype) with tf.Graph().as_default(): with tf.Session(config=tf.ConfigProto(log_device_placement=False)) as sess: with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_dtype, [None, None], 'a') tf_b = tf.placeholder(tf_dtype, [None, None], 'b') tf_c = tf.__dict__[tf_func](tf_a, tf_b, name="c") np.random.seed(123) shape = (1, 10) a = np.random.choice(50, shape) / 25 b = np.random.choice(50, shape) / 25 if 'int' in dtype: a *= 10 b *= 10 a = a.astype(np_dtype) b = b.astype(np_dtype) ar, br, cr = sess.run((tf_a, tf_b, tf_c), {tf_a: a, tf_b: b}) print('a', ar) print('b', br) c_py = eval(py_func).astype(np_dtype) print('expected', c_py) print('gpu', cr) diff = np.abs(c_py - cr).max() print('diff', diff) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for pow E assert 1.6296794e+23 < 0.0001 tensorflow/stream_executor/cl/test/test_binary_ops.py:77: AssertionError ----------------------------- Captured stdout call ----------------------------- func pow float32 a [[ 1.79999995 0.08 1.12 1.36000001 1.51999998 0.68000001 0.75999999 1.67999995 0.88 1.32000005]] b [[ 1.27999997 1.96000004 1.88 0.36000001 1.27999997 1.84000003 1.27999997 1.88 1. 0.75999999]] expected [[ 2.12201667 0.00708038 1.23745632 1.11705363 1.70906973 0.49183157 0.70378727 2.65204835 0.88 1.23491251]] gpu [[ -2.95498072e-35 -2.95498072e-35 1.62967941e+23 1.62967941e+23 -2.95498072e-35 -2.95498072e-35 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23]] diff 1.62968e+23 ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) ____________________ test[float32-minimum-np.minimum(a,b)] _____________________ dtype = 'float32', tf_func = 'minimum', py_func = 'np.minimum(a,b)' @pytest.mark.parametrize( 'dtype,tf_func,py_func', [d['mark']((d['dtype'], d['tf_func'], d['py_func'])) for d in get_test_funcs()]) def test(dtype, tf_func, py_func): print('func', tf_func, dtype) np_dtype = eval('np.%s' % dtype) tf_dtype = eval('tf.%s' % dtype) with tf.Graph().as_default(): with tf.Session(config=tf.ConfigProto(log_device_placement=False)) as sess: with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_dtype, [None, None], 'a') tf_b = tf.placeholder(tf_dtype, [None, None], 'b') tf_c = tf.__dict__[tf_func](tf_a, tf_b, name="c") np.random.seed(123) shape = (1, 10) a = np.random.choice(50, shape) / 25 b = np.random.choice(50, shape) / 25 if 'int' in dtype: a *= 10 b *= 10 a = a.astype(np_dtype) b = b.astype(np_dtype) ar, br, cr = sess.run((tf_a, tf_b, tf_c), {tf_a: a, tf_b: b}) print('a', ar) print('b', br) c_py = eval(py_func).astype(np_dtype) print('expected', c_py) print('gpu', cr) diff = np.abs(c_py - cr).max() print('diff', diff) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for minimum E assert 1.6296794e+23 < 0.0001 tensorflow/stream_executor/cl/test/test_binary_ops.py:77: AssertionError ----------------------------- Captured stdout call ----------------------------- func minimum float32 a [[ 1.79999995 0.08 1.12 1.36000001 1.51999998 0.68000001 0.75999999 1.67999995 0.88 1.32000005]] b [[ 1.27999997 1.96000004 1.88 0.36000001 1.27999997 1.84000003 1.27999997 1.88 1. 0.75999999]] expected [[ 1.27999997 0.08 1.12 0.36000001 1.27999997 0.68000001 0.75999999 1.67999995 0.88 0.75999999]] gpu [[ 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23]] diff 1.62968e+23 ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) ______________ test[float32-squared_difference-(a - b) * (a - b)] ______________ dtype = 'float32', tf_func = 'squared_difference', py_func = '(a - b) * (a - b)' @pytest.mark.parametrize( 'dtype,tf_func,py_func', [d['mark']((d['dtype'], d['tf_func'], d['py_func'])) for d in get_test_funcs()]) def test(dtype, tf_func, py_func): print('func', tf_func, dtype) np_dtype = eval('np.%s' % dtype) tf_dtype = eval('tf.%s' % dtype) with tf.Graph().as_default(): with tf.Session(config=tf.ConfigProto(log_device_placement=False)) as sess: with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_dtype, [None, None], 'a') tf_b = tf.placeholder(tf_dtype, [None, None], 'b') tf_c = tf.__dict__[tf_func](tf_a, tf_b, name="c") np.random.seed(123) shape = (1, 10) a = np.random.choice(50, shape) / 25 b = np.random.choice(50, shape) / 25 if 'int' in dtype: a *= 10 b *= 10 a = a.astype(np_dtype) b = b.astype(np_dtype) ar, br, cr = sess.run((tf_a, tf_b, tf_c), {tf_a: a, tf_b: b}) print('a', ar) print('b', br) c_py = eval(py_func).astype(np_dtype) print('expected', c_py) print('gpu', cr) diff = np.abs(c_py - cr).max() print('diff', diff) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for squared_difference E assert 1.6296794e+23 < 0.0001 tensorflow/stream_executor/cl/test/test_binary_ops.py:77: AssertionError ----------------------------- Captured stdout call ----------------------------- func squared_difference float32 a [[ 1.79999995 0.08 1.12 1.36000001 1.51999998 0.68000001 0.75999999 1.67999995 0.88 1.32000005]] b [[ 1.27999997 1.96000004 1.88 0.36000001 1.27999997 1.84000003 1.27999997 1.88 1. 0.75999999]] expected [[ 0.27039999 3.53439999 0.5776 1. 0.0576 1.34560025 0.27039999 0.04000002 0.0144 0.31360006]] gpu [[ 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23]] diff 1.62968e+23 ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) ____________________ test[float32-maximum-np.maximum(a,b)] _____________________ dtype = 'float32', tf_func = 'maximum', py_func = 'np.maximum(a,b)' @pytest.mark.parametrize( 'dtype,tf_func,py_func', [d['mark']((d['dtype'], d['tf_func'], d['py_func'])) for d in get_test_funcs()]) def test(dtype, tf_func, py_func): print('func', tf_func, dtype) np_dtype = eval('np.%s' % dtype) tf_dtype = eval('tf.%s' % dtype) with tf.Graph().as_default(): with tf.Session(config=tf.ConfigProto(log_device_placement=False)) as sess: with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_dtype, [None, None], 'a') tf_b = tf.placeholder(tf_dtype, [None, None], 'b') tf_c = tf.__dict__[tf_func](tf_a, tf_b, name="c") np.random.seed(123) shape = (1, 10) a = np.random.choice(50, shape) / 25 b = np.random.choice(50, shape) / 25 if 'int' in dtype: a *= 10 b *= 10 a = a.astype(np_dtype) b = b.astype(np_dtype) ar, br, cr = sess.run((tf_a, tf_b, tf_c), {tf_a: a, tf_b: b}) print('a', ar) print('b', br) c_py = eval(py_func).astype(np_dtype) print('expected', c_py) print('gpu', cr) diff = np.abs(c_py - cr).max() print('diff', diff) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for maximum E assert 1.6296794e+23 < 0.0001 tensorflow/stream_executor/cl/test/test_binary_ops.py:77: AssertionError ----------------------------- Captured stdout call ----------------------------- func maximum float32 a [[ 1.79999995 0.08 1.12 1.36000001 1.51999998 0.68000001 0.75999999 1.67999995 0.88 1.32000005]] b [[ 1.27999997 1.96000004 1.88 0.36000001 1.27999997 1.84000003 1.27999997 1.88 1. 0.75999999]] expected [[ 1.79999995 1.96000004 1.88 1.36000001 1.51999998 1.84000003 1.27999997 1.88 1. 1.32000005]] gpu [[ 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23]] diff 1.62968e+23 ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) ___________________________ test[float32-mul-a * b] ____________________________ dtype = 'float32', tf_func = 'mul', py_func = 'a * b' @pytest.mark.parametrize( 'dtype,tf_func,py_func', [d['mark']((d['dtype'], d['tf_func'], d['py_func'])) for d in get_test_funcs()]) def test(dtype, tf_func, py_func): print('func', tf_func, dtype) np_dtype = eval('np.%s' % dtype) tf_dtype = eval('tf.%s' % dtype) with tf.Graph().as_default(): with tf.Session(config=tf.ConfigProto(log_device_placement=False)) as sess: with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_dtype, [None, None], 'a') tf_b = tf.placeholder(tf_dtype, [None, None], 'b') tf_c = tf.__dict__[tf_func](tf_a, tf_b, name="c") np.random.seed(123) shape = (1, 10) a = np.random.choice(50, shape) / 25 b = np.random.choice(50, shape) / 25 if 'int' in dtype: a *= 10 b *= 10 a = a.astype(np_dtype) b = b.astype(np_dtype) ar, br, cr = sess.run((tf_a, tf_b, tf_c), {tf_a: a, tf_b: b}) print('a', ar) print('b', br) c_py = eval(py_func).astype(np_dtype) print('expected', c_py) print('gpu', cr) diff = np.abs(c_py - cr).max() print('diff', diff) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for mul E assert 1.6296794e+23 < 0.0001 tensorflow/stream_executor/cl/test/test_binary_ops.py:77: AssertionError ----------------------------- Captured stdout call ----------------------------- func mul float32 a [[ 1.79999995 0.08 1.12 1.36000001 1.51999998 0.68000001 0.75999999 1.67999995 0.88 1.32000005]] b [[ 1.27999997 1.96000004 1.88 0.36000001 1.27999997 1.84000003 1.27999997 1.88 1. 0.75999999]] expected [[ 2.3039999 0.1568 2.10560012 0.48960003 1.94559991 1.25120008 0.97279996 3.15839982 0.88 1.00320005]] gpu [[ 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23 1.62967941e+23]] diff 1.62968e+23 ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) ________________________________ test_indexing _________________________________ def test_indexing(): with tf.Graph().as_default(): with tf.device('/gpu:0'): tf_a = tf.placeholder(tf.float32, [rows, cols], 'a') tf_out = tf_a[0] tf_out2 = tf_a[0:3] tf_out3 = tf.transpose(tf_a)[0:3] a = np.random.randn(rows, cols).astype(np.float32) with tf.Session(config=tf.ConfigProto(log_device_placement=False)) as sess: out, out2, out3 = sess.run((tf_out, tf_out2, tf_out3), {tf_a: a}) # print('a', a) print('out', out) print('a[0]', a[0]) assert np.all(a[0] == out) print('a[0:3]', a[0:3]) print('out2', out2) assert np.all(a[0:3] == out2) print('a.T[0:3]', a.T[0:3]) print('out3', out3) > assert np.all(a.T[0:3] == out3) E AssertionError: assert False E + where False = (array([[ 0.59...dtype=float32) == array([[ 0.592...dtype=float32) E + where = np.all E Full diff: E - array([[ 0.59248137, -0.09081998, 0.94202846, -0.71988308, -0.42924997, E - -0.24426287, 0.93414474, 1.70890749, -2.29473805, 0.48660588], E - [-0.26846331, -0.55512631, -0.32740313, -0.1307299 , -1.80516779, E - 1.40592456, -0.72184014, -0.88272059, 0.68439531, 0.31756681], E - [-2.81946826, 0.99082071, 0.18746737, -0.14282662, 0.87862599, E - 0.08149707, -0.52517313, 1.36568308, 0.74341929, 0.82305646]], dtype=float32)... E E ...Full output truncated (7 lines hidden), use '-vv' to show) tensorflow/stream_executor/cl/test/test_misc.py:34: AssertionError ----------------------------- Captured stdout call ----------------------------- out [ 0.59248137 -0.26846331 -2.81946826 -0.81436372 0.40309516 -0.15077893 -1.52033937 1.36421645 -1.27263343 0.48493031 -0.43288949 -1.04925716 0.02921385 1.12904263 0.20133996] a[0] [ 0.59248137 -0.26846331 -2.81946826 -0.81436372 0.40309516 -0.15077893 -1.52033937 1.36421645 -1.27263343 0.48493031 -0.43288949 -1.04925716 0.02921385 1.12904263 0.20133996] a[0:3] [[ 0.59248137 -0.26846331 -2.81946826 -0.81436372 0.40309516 -0.15077893 -1.52033937 1.36421645 -1.27263343 0.48493031 -0.43288949 -1.04925716 0.02921385 1.12904263 0.20133996] [-0.09081998 -0.55512631 0.99082071 1.74093425 -1.0198406 -1.50583804 -0.58549309 -0.20095173 -0.35478145 -0.67514992 -1.52213848 0.25725743 -0.81593567 -2.04217124 -1.55675828] [ 0.94202846 -0.32740313 0.18746737 -1.78067255 -0.30793607 1.15806341 0.4528318 0.16523083 -0.06149857 0.79919046 0.74911582 -2.18284631 0.38942859 0.91862577 0.74026501]] out2 [[ 0.59248137 -0.26846331 -2.81946826 -0.81436372 0.40309516 -0.15077893 -1.52033937 1.36421645 -1.27263343 0.48493031 -0.43288949 -1.04925716 0.02921385 1.12904263 0.20133996] [-0.09081998 -0.55512631 0.99082071 1.74093425 -1.0198406 -1.50583804 -0.58549309 -0.20095173 -0.35478145 -0.67514992 -1.52213848 0.25725743 -0.81593567 -2.04217124 -1.55675828] [ 0.94202846 -0.32740313 0.18746737 -1.78067255 -0.30793607 1.15806341 0.4528318 0.16523083 -0.06149857 0.79919046 0.74911582 -2.18284631 0.38942859 0.91862577 0.74026501]] a.T[0:3] [[ 0.59248137 -0.09081998 0.94202846 -0.71988308 -0.42924997 -0.24426287 0.93414474 1.70890749 -2.29473805 0.48660588] [-0.26846331 -0.55512631 -0.32740313 -0.1307299 -1.80516779 1.40592456 -0.72184014 -0.88272059 0.68439531 0.31756681] [-2.81946826 0.99082071 0.18746737 -0.14282662 0.87862599 0.08149707 -0.52517313 1.36568308 0.74341929 0.82305646]] out3 [[ 0.59248137 -0.26846331 -2.81946826 -0.81436372 0.40309516 -0.15077893 -1.52033937 1.36421645 -1.27263343 0.48493031] [-0.43288949 -1.04925716 0.02921385 1.12904263 0.20133996 -0.09081998 -0.55512631 0.99082071 1.74093425 -1.0198406 ] [-1.50583804 -0.58549309 -0.20095173 -0.35478145 -0.67514992 -1.52213848 0.25725743 -0.81593567 -2.04217124 -1.55675828]] ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) __________________________________ test_split __________________________________ def test_split(): shape = (72, 1) graph = tf.Graph() np.random.seed(123) a = np.random.randn(*shape).astype(np.float32) print('a.reshape(-1)[:10]', a.reshape(-1)[:10]) with graph.as_default(): with tf.device('/gpu:0'): a_tf = tf.placeholder(tf.float32, shape) c_tf = tf.split(0, 4, a_tf) sess = tf.Session() with sess.as_default(): c_gpu = sess.run(c_tf, feed_dict={a_tf: a}) print('c_gpu[0]', c_gpu[0].reshape(-1)[:10]) with tf.device('/cpu:0'): a_tf = tf.placeholder(tf.float32, shape) c_tf = tf.split(0, 4, a_tf) sess = tf.Session() with sess.as_default(): c_cpu = sess.run(c_tf, feed_dict={a_tf: a}) print('c_cpu[0]', c_cpu[0].reshape(-1)[:10]) for i in range(len(c_cpu)): print('i', i) print(' cpu', c_cpu[i].reshape(-1)[:10]) print(' gpu', c_gpu[i].reshape(-1)[:10]) > assert np.all(np.abs(c_cpu[i] - c_gpu[i]) <= 1e-4) E AssertionError: assert False E + where False = (array([[ 0.60932881],\n [ 2.78368068],\n [ 0.98584002],\n [ 1.34047151],\n [ 1.07363653],\n [... [ 0.37062746],\n [ 0.32299316],\n [ 0.45961019],\n [ 1.84789693],\n [ 0.71159697]], dtype=float32) <= 0.0001) E + where = np.all E + and array([[ 0.60932881],\n [ 2.78368068],\n [ 0.98584002],\n [ 1.34047151],\n [ 1.07363653],\n [... [ 0.37062746],\n [ 0.32299316],\n [ 0.45961019],\n [ 1.84789693],\n [ 0.71159697]], dtype=float32) = ((array([[ 0.02968323],\n [ 1.06931591],\n [ 0.89070642],\n [ 1.75488615],\n [ 1.49564409],\n [... [-0.23309205],\n [-1.1983012 ],\n [ 0.19952407],\n [ 0.46843913],\n [-0.831155 ]], dtype=float32) - array([[-0.57964557],\n [-1.71436477],\n [-0.09513362],\n [ 0.41441464],\n [ 0.4220075 ],\n [... [-0.60371953],\n [-1.52129436],\n [ 0.65913427],\n [-1.37945783],\n [-0.11955801]], dtype=float32))) E + where = np.abs tensorflow/stream_executor/cl/test/test_misc.py:185: AssertionError ----------------------------- Captured stdout call ----------------------------- a.reshape(-1)[:10] [-1.08563066 0.99734545 0.2829785 -1.50629473 -0.57860023 1.65143657 -2.42667913 -0.42891264 1.26593626 -0.86674041] c_gpu[0] [-1.08563066 0.99734545 0.2829785 -1.50629473 -0.57860023 1.65143657 -2.42667913 -0.42891264 1.26593626 -0.86674041] c_cpu[0] [-1.08563066 0.99734545 0.2829785 -1.50629473 -0.57860023 1.65143657 -2.42667913 -0.42891264 1.26593626 -0.86674041] i 0 cpu [-1.08563066 0.99734545 0.2829785 -1.50629473 -0.57860023 1.65143657 -2.42667913 -0.42891264 1.26593626 -0.86674041] gpu [-1.08563066 0.99734545 0.2829785 -1.50629473 -0.57860023 1.65143657 -2.42667913 -0.42891264 1.26593626 -0.86674041] i 1 cpu [ 1.00405395 0.38618639 0.73736858 1.49073207 -0.93583387 1.17582905 -1.25388062 -0.63775152 0.90710521 -1.42868066] gpu [ 1.00405395 0.38618639 0.73736858 1.49073207 -0.93583387 1.17582905 -1.25388062 -0.63775152 0.90710521 -1.42868066] i 2 cpu [ 0.00284592 0.68822271 -0.87953633 0.28362733 -0.80536652 -1.72766948 -0.39089981 0.57380587 0.33858904 -0.01183049] gpu [ 0.00284592 0.68822271 -0.87953633 0.28362733 -0.80536652 -1.72766948 -0.39089981 0.57380587 0.33858904 -0.01183049] i 3 cpu [ 0.02968323 1.06931591 0.89070642 1.75488615 1.49564409 1.06939268 -0.77270871 0.79486269 0.31427199 -1.32626545] gpu [-0.57964557 -1.71436477 -0.09513362 0.41441464 0.4220075 1.94375181 -1.03667223 -0.5181613 -0.16394351 1.47472703] ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) ________________ test[reduce_mean-np.mean-0-tf.float32-shape0] _________________ tf_func = 'reduce_mean', py_func = 'np.mean', axes = (0,), tf_type = tf.float32 shape = (3, 17) @pytest.mark.parametrize('tf_func, py_func, axes, tf_type, shape', [(d['tf_func'], d['py_func'], d['axes'], d['tf_type'], d['shape']) for d in get_test_params()]) def test(tf_func, py_func, axes, tf_type, shape): print('func', tf_func, 'axes', axes, tf_type, shape) tf_type = eval(tf_type) if axes != 'None': axes = '(%s,)' % axes axes = eval(axes) with tf.Graph().as_default(): with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_type, [None, None], 'a') tf_c = tf.__dict__[tf_func](tf_a, reduction_indices=axes, name="c") print('tf_c', tf_c) with tf.Session(config=tf.ConfigProto(log_device_placement=show_placement)) as sess: np.random.seed(123) if tf_type == tf.float32: a = np.random.choice(50, shape) / 25 - 1 else: a = np.random.choice(50, shape) ar, cr = sess.run((tf_a, tf_c), {tf_a: a}) c_py = eval(py_func + '(a, axes)') diff = np.abs(c_py - cr).max() if diff >= 1e-4: print('ar', ar) print('c_py', c_py) print('cr', cr) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for reduce_mean E assert 1.7681189187367758 < 0.0001 tensorflow/stream_executor/cl/test/test_reductions.py:61: AssertionError ----------------------------- Captured stdout call ----------------------------- func reduce_mean axes 0 tf.float32 (3, 17) tf_c Tensor("c:0", shape=(?,), dtype=float32, device=/device:GPU:0) ar [[ 0.80000001 -0.92000002 0.12 0.36000001 0.51999998 -0.31999999 -0.23999999 0.68000001 -0.12 0.31999999 0.28 0.95999998 0.88 -0.63999999 0.28 0.83999997 0.28 ] [ 0.88 0. -0.23999999 -0.44 0.44 0.28 -0.36000001 -0.83999997 0.95999998 -0.88 -0.92000002 -0.2 0.56 -0.92000002 -0.2 0.88 0.92000002] [-0.72000003 0.63999999 0.40000001 0.12 0.51999998 0.31999999 -0.16 0.2 0.08 0.36000001 0.31999999 -0.51999998 0.60000002 -0.88 0.68000001 -0.80000001 -1. ]] c_py [ 0.32 -0.09333333 0.09333333 0.01333333 0.49333333 0.09333333 -0.25333333 0.01333333 0.30666667 -0.06666667 -0.10666667 0.08 0.68 -0.81333333 0.25333333 0.30666667 0.06666667] cr [ 0.50968552 0.36521173 0.32829726 0.53815091 0.37836313 0.25536275 0.7413882 0.28779244 0.78296661 0.02386034 0.52429295 0.56355608 0.29599369 0.95478559 0.11568081 0.35152161 0.81988204] ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) _______________ test[reduce_mean-np.mean-None-tf.float32-shape2] _______________ tf_func = 'reduce_mean', py_func = 'np.mean', axes = None, tf_type = tf.float32 shape = (3, 17) @pytest.mark.parametrize('tf_func, py_func, axes, tf_type, shape', [(d['tf_func'], d['py_func'], d['axes'], d['tf_type'], d['shape']) for d in get_test_params()]) def test(tf_func, py_func, axes, tf_type, shape): print('func', tf_func, 'axes', axes, tf_type, shape) tf_type = eval(tf_type) if axes != 'None': axes = '(%s,)' % axes axes = eval(axes) with tf.Graph().as_default(): with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_type, [None, None], 'a') tf_c = tf.__dict__[tf_func](tf_a, reduction_indices=axes, name="c") print('tf_c', tf_c) with tf.Session(config=tf.ConfigProto(log_device_placement=show_placement)) as sess: np.random.seed(123) if tf_type == tf.float32: a = np.random.choice(50, shape) / 25 - 1 else: a = np.random.choice(50, shape) ar, cr = sess.run((tf_a, tf_c), {tf_a: a}) c_py = eval(py_func + '(a, axes)') diff = np.abs(c_py - cr).max() if diff >= 1e-4: print('ar', ar) print('c_py', c_py) print('cr', cr) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for reduce_mean E assert 0.72265359869190293 < 0.0001 tensorflow/stream_executor/cl/test/test_reductions.py:61: AssertionError ----------------------------- Captured stdout call ----------------------------- func reduce_mean axes None tf.float32 (3, 17) tf_c Tensor("c:0", shape=(), dtype=float32, device=/device:GPU:0) ar [[ 0.80000001 -0.92000002 0.12 0.36000001 0.51999998 -0.31999999 -0.23999999 0.68000001 -0.12 0.31999999 0.28 0.95999998 0.88 -0.63999999 0.28 0.83999997 0.28 ] [ 0.88 0. -0.23999999 -0.44 0.44 0.28 -0.36000001 -0.83999997 0.95999998 -0.88 -0.92000002 -0.2 0.56 -0.92000002 -0.2 0.88 0.92000002] [-0.72000003 0.63999999 0.40000001 0.12 0.51999998 0.31999999 -0.16 0.2 0.08 0.36000001 0.31999999 -0.51999998 0.60000002 -0.88 0.68000001 -0.80000001 -1. ]] c_py 0.081568627451 cr 0.804222 ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) ________________ test[reduce_prod-np.prod-0-tf.float32-shape3] _________________ tf_func = 'reduce_prod', py_func = 'np.prod', axes = (0,), tf_type = tf.float32 shape = (3, 17) @pytest.mark.parametrize('tf_func, py_func, axes, tf_type, shape', [(d['tf_func'], d['py_func'], d['axes'], d['tf_type'], d['shape']) for d in get_test_params()]) def test(tf_func, py_func, axes, tf_type, shape): print('func', tf_func, 'axes', axes, tf_type, shape) tf_type = eval(tf_type) if axes != 'None': axes = '(%s,)' % axes axes = eval(axes) with tf.Graph().as_default(): with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_type, [None, None], 'a') tf_c = tf.__dict__[tf_func](tf_a, reduction_indices=axes, name="c") print('tf_c', tf_c) with tf.Session(config=tf.ConfigProto(log_device_placement=show_placement)) as sess: np.random.seed(123) if tf_type == tf.float32: a = np.random.choice(50, shape) / 25 - 1 else: a = np.random.choice(50, shape) ar, cr = sess.run((tf_a, tf_c), {tf_a: a}) c_py = eval(py_func + '(a, axes)') diff = np.abs(c_py - cr).max() if diff >= 1e-4: print('ar', ar) print('c_py', c_py) print('cr', cr) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for reduce_prod E assert 1.5621704133605956 < 0.0001 tensorflow/stream_executor/cl/test/test_reductions.py:61: AssertionError ----------------------------- Captured stdout call ----------------------------- func reduce_prod axes 0 tf.float32 (3, 17) tf_c Tensor("c:0", shape=(?,), dtype=float32, device=/device:GPU:0) ar [[ 0.80000001 -0.92000002 0.12 0.36000001 0.51999998 -0.31999999 -0.23999999 0.68000001 -0.12 0.31999999 0.28 0.95999998 0.88 -0.63999999 0.28 0.83999997 0.28 ] [ 0.88 0. -0.23999999 -0.44 0.44 0.28 -0.36000001 -0.83999997 0.95999998 -0.88 -0.92000002 -0.2 0.56 -0.92000002 -0.2 0.88 0.92000002] [-0.72000003 0.63999999 0.40000001 0.12 0.51999998 0.31999999 -0.16 0.2 0.08 0.36000001 0.31999999 -0.51999998 0.60000002 -0.88 0.68000001 -0.80000001 -1. ]] c_py [-0.50688 -0. -0.01152 -0.019008 0.118976 -0.028672 -0.013824 -0.11424 -0.009216 -0.101376 -0.082432 0.09984 0.29568 -0.518144 -0.03808 -0.59136 -0.2576 ] cr [ 0.87831759 0.42684686 0.81497359 0.91506481 0.85628068 0.0301404 0.47870648 0.84566617 0.94483602 0.71826708 0.30373967 0.13165188 0.90610254 0.845662 0.34833121 0.97081041 0.29695487] ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) _______________ test[reduce_prod-np.prod-None-tf.float32-shape5] _______________ tf_func = 'reduce_prod', py_func = 'np.prod', axes = None, tf_type = tf.float32 shape = (3, 17) @pytest.mark.parametrize('tf_func, py_func, axes, tf_type, shape', [(d['tf_func'], d['py_func'], d['axes'], d['tf_type'], d['shape']) for d in get_test_params()]) def test(tf_func, py_func, axes, tf_type, shape): print('func', tf_func, 'axes', axes, tf_type, shape) tf_type = eval(tf_type) if axes != 'None': axes = '(%s,)' % axes axes = eval(axes) with tf.Graph().as_default(): with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_type, [None, None], 'a') tf_c = tf.__dict__[tf_func](tf_a, reduction_indices=axes, name="c") print('tf_c', tf_c) with tf.Session(config=tf.ConfigProto(log_device_placement=show_placement)) as sess: np.random.seed(123) if tf_type == tf.float32: a = np.random.choice(50, shape) / 25 - 1 else: a = np.random.choice(50, shape) ar, cr = sess.run((tf_a, tf_c), {tf_a: a}) c_py = eval(py_func + '(a, axes)') diff = np.abs(c_py - cr).max() if diff >= 1e-4: print('ar', ar) print('c_py', c_py) print('cr', cr) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for reduce_prod E assert 0.078043818473815918 < 0.0001 tensorflow/stream_executor/cl/test/test_reductions.py:61: AssertionError ----------------------------- Captured stdout call ----------------------------- func reduce_prod axes None tf.float32 (3, 17) tf_c Tensor("c:0", shape=(), dtype=float32, device=/device:GPU:0) ar [[ 0.80000001 -0.92000002 0.12 0.36000001 0.51999998 -0.31999999 -0.23999999 0.68000001 -0.12 0.31999999 0.28 0.95999998 0.88 -0.63999999 0.28 0.83999997 0.28 ] [ 0.88 0. -0.23999999 -0.44 0.44 0.28 -0.36000001 -0.83999997 0.95999998 -0.88 -0.92000002 -0.2 0.56 -0.92000002 -0.2 0.88 0.92000002] [-0.72000003 0.63999999 0.40000001 0.12 0.51999998 0.31999999 -0.16 0.2 0.08 0.36000001 0.31999999 -0.51999998 0.60000002 -0.88 0.68000001 -0.80000001 -1. ]] c_py 0.0 cr 0.0780438 ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) _________________ test[reduce_min-np.min-0-tf.float32-shape6] __________________ tf_func = 'reduce_min', py_func = 'np.min', axes = (0,), tf_type = tf.float32 shape = (3, 17) @pytest.mark.parametrize('tf_func, py_func, axes, tf_type, shape', [(d['tf_func'], d['py_func'], d['axes'], d['tf_type'], d['shape']) for d in get_test_params()]) def test(tf_func, py_func, axes, tf_type, shape): print('func', tf_func, 'axes', axes, tf_type, shape) tf_type = eval(tf_type) if axes != 'None': axes = '(%s,)' % axes axes = eval(axes) with tf.Graph().as_default(): with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_type, [None, None], 'a') tf_c = tf.__dict__[tf_func](tf_a, reduction_indices=axes, name="c") print('tf_c', tf_c) with tf.Session(config=tf.ConfigProto(log_device_placement=show_placement)) as sess: np.random.seed(123) if tf_type == tf.float32: a = np.random.choice(50, shape) / 25 - 1 else: a = np.random.choice(50, shape) ar, cr = sess.run((tf_a, tf_c), {tf_a: a}) c_py = eval(py_func + '(a, axes)') diff = np.abs(c_py - cr).max() if diff >= 1e-4: print('ar', ar) print('c_py', c_py) print('cr', cr) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for reduce_min E assert 1.9061719608306884 < 0.0001 tensorflow/stream_executor/cl/test/test_reductions.py:61: AssertionError ----------------------------- Captured stdout call ----------------------------- func reduce_min axes 0 tf.float32 (3, 17) tf_c Tensor("c:0", shape=(?,), dtype=float32, device=/device:GPU:0) ar [[ 0.80000001 -0.92000002 0.12 0.36000001 0.51999998 -0.31999999 -0.23999999 0.68000001 -0.12 0.31999999 0.28 0.95999998 0.88 -0.63999999 0.28 0.83999997 0.28 ] [ 0.88 0. -0.23999999 -0.44 0.44 0.28 -0.36000001 -0.83999997 0.95999998 -0.88 -0.92000002 -0.2 0.56 -0.92000002 -0.2 0.88 0.92000002] [-0.72000003 0.63999999 0.40000001 0.12 0.51999998 0.31999999 -0.16 0.2 0.08 0.36000001 0.31999999 -0.51999998 0.60000002 -0.88 0.68000001 -0.80000001 -1. ]] c_py [-0.72 -0.92 -0.24 -0.44 0.44 -0.32 -0.36 -0.84 -0.12 -0.88 -0.92 -0.52 0.56 -0.92 -0.2 -0.8 -1. ] cr [ 0.46549356 0.44926107 0.08426809 0.40366268 0.77312374 0.99956751 0.03708971 0.45779407 0.47052598 0.37590086 0.98617196 0.44109166 0.30274701 0.01699126 0.53706312 0.45728016 0.80803561] ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) _________________ test[reduce_min-np.min-1-tf.float32-shape7] __________________ tf_func = 'reduce_min', py_func = 'np.min', axes = (1,), tf_type = tf.float32 shape = (3, 17) @pytest.mark.parametrize('tf_func, py_func, axes, tf_type, shape', [(d['tf_func'], d['py_func'], d['axes'], d['tf_type'], d['shape']) for d in get_test_params()]) def test(tf_func, py_func, axes, tf_type, shape): print('func', tf_func, 'axes', axes, tf_type, shape) tf_type = eval(tf_type) if axes != 'None': axes = '(%s,)' % axes axes = eval(axes) with tf.Graph().as_default(): with tf.device('/gpu:0'): tf_a = tf.placeholder(tf_type, [None, None], 'a') tf_c = tf.__dict__[tf_func](tf_a, reduction_indices=axes, name="c") print('tf_c', tf_c) with tf.Session(config=tf.ConfigProto(log_device_placement=show_placement)) as sess: np.random.seed(123) if tf_type == tf.float32: a = np.random.choice(50, shape) / 25 - 1 else: a = np.random.choice(50, shape) ar, cr = sess.run((tf_a, tf_c), {tf_a: a}) c_py = eval(py_func + '(a, axes)') diff = np.abs(c_py - cr).max() if diff >= 1e-4: print('ar', ar) print('c_py', c_py) print('cr', cr) > assert diff < 1e-4, 'failed for %s' % tf_func E AssertionError: failed for reduce_min E assert 1.722643256187439 < 0.0001 tensorflow/stream_executor/cl/test/test_reductions.py:61: AssertionError ----------------------------- Captured stdout call ----------------------------- func reduce_min axes 1 tf.float32 (3, 17) tf_c Tensor("c:0", shape=(?,), dtype=float32, device=/device:GPU:0) ar [[ 0.80000001 -0.92000002 0.12 0.36000001 0.51999998 -0.31999999 -0.23999999 0.68000001 -0.12 0.31999999 0.28 0.95999998 0.88 -0.63999999 0.28 0.83999997 0.28 ] [ 0.88 0. -0.23999999 -0.44 0.44 0.28 -0.36000001 -0.83999997 0.95999998 -0.88 -0.92000002 -0.2 0.56 -0.92000002 -0.2 0.88 0.92000002] [-0.72000003 0.63999999 0.40000001 0.12 0.51999998 0.31999999 -0.16 0.2 0.08 0.36000001 0.31999999 -0.51999998 0.60000002 -0.88 0.68000001 -0.80000001 -1. ]] c_py [-0.92 -0.92 -1. ] cr [ 0.50705755 0.70948446 0.72264326] ----------------------------- Captured stderr call ----------------------------- I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tahiti, pci bus id: 0000.0000) I tensorflow/core/common_runtime/gpu/gpu_device.cc:1083] Creating TensorFlow device (/gpu:1) -> (device: 1, name: Tahiti, pci bus id: 0000.0000) ========== 14 failed, 64 passed, 2 skipped, 2 xfailed in 8.92 seconds ========== Device mapping: /job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: Tahiti, pci bus id: 0000.0000 /job:localhost/replica:0/task:0/gpu:1 -> device: 1, name: Tahiti, pci bus id: 0000.0000 c: /job:localhost/replica:0/task:0/gpu:0 b: /job:localhost/replica:0/task:0/gpu:0 a: /job:localhost/replica:0/task:0/gpu:0 Device mapping: /job:localhost/replica:0/task:0/gpu:0 -> device: 0, name: Tahiti, pci bus id: 0000.0000 /job:localhost/replica:0/task:0/gpu:1 -> device: 1, name: Tahiti, pci bus id: 0000.0000 c: /job:localhost/replica:0/task:0/gpu:0 b: /job:localhost/replica:0/task:0/gpu:0 a: /job:localhost/replica:0/task:0/gpu:0