tf-coriander: `split` failing

Relevant test:

https://github.com/hughperkins/tensorflow-cl/blob/dcdb5a64385c72aafa19e5fb9e16e64ec42ad751/tensorflow/stream_executor/cl/test/test_misc.py#L158-L180

def test_split():
    shape = (12, 1)
    graph = tf.Graph()
    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():
                a = np.random.randn(*shape).astype(np.float32)
                c = sess.run(c_tf, feed_dict={a_tf: a})
                if(np.prod(shape)) < 20:
                    print('a', a)
                    print('c', c)

Result:

a [[ 0.039643  ]
 [ 1.02737081]
 [-1.39692032]
 [-0.08065519]
 [ 0.77159059]
 [ 1.21571183]
 [ 0.12854558]
 [ 3.13103628]
 [-0.31965023]
 [-0.41063583]
 [-1.0400176 ]
 [ 0.10558813]]
c [array([[ nan],
       [ nan],
       [ nan]], dtype=float32), array([[ nan],
       [ nan],
       [ nan]], dtype=float32), array([[ nan],
       [ nan],
       [ nan]], dtype=float32), array([[ nan],
       [ nan],
       [ nan]], dtype=float32)]

(should not be nans…)

Update: looks like this involves passing a float ** into the kernel 😛 . THis is one of the kernel parameters:

struct tensorflow__CudaDeviceArrayStruct {
    int f0;
    float* f1[8];
    global float** f2;
};

(in bytecode:

%"struct.tensorflow::CudaDeviceArrayStruct" = type { i32, [8 x float*], float** }

)

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 41 (35 by maintainers)

Most upvoted comments

Wheee! split working in https://github.com/hughperkins/coriander/commit/98e2526727482de3e5edd6e897179a1d7b08015e 😮

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.02968323  1.06931591  0.89070642  1.75488615  1.49564409  1.06939268
 -0.77270871  0.79486269  0.31427199 -1.32626545]
PASSED

----------- generated xml file: /Users/hugh2/git-local/tensorflow-dev/test/junit-pytest-report.xml -----------
============================================= 9 tests deselected =============================================
=================================== 1 passed, 9 deselected in 2.09 seconds ==============================

It’s a “bit” spammy, and I need to commit the changes to tf-coriander and so on, but seems promising to me 😃