Sorting tf.float32 in Tensorflow

See the following issues:

https://github.com/tensorflow/tensorflow/issues/51820

https://github.com/tensorflow/tensorflow/issues/51499

This issue is still persistent in Tensorflow 3.6.0.

The following demonstrates the bug easily...

for device in ['/cpu:0', '/gpu:0']:
    with tf.device(device): 
        tf.print(tf.sort(y), summarize=-1)
        
[-0.554460645 -0.464435279 -0.3819125 -0.26858753 -0.247115687 -0.241563916 -0.238910735 -0.234633669 -0.109736279 -0.00934277847 0.0918735489 0.111700684 0.114819914 0.117980212 0.128462791 0.158333018 0.257014751 0.346840918 0.385897338 0.391006947]
[-0.554460645 -0.464435279 -0.3819125 -0.26858753 -0.247115687 -0.241563916 -0.238910735 -0.234633669 -0.109736279 -0.00934277847 0.0918735489 0.111700684 0.114819914 0.117980212 0.128462791 0.158333018 -0 -0 -0 -0]

Is there a place to file a bug report against the tensorflow-metal codebase? Is there a general mechanism to know the general status of this bug?

Thanks for reporting the issue @cyrusomega. I've reproduced the issue and we are looking into it. I'll update here once there is a resolution to this.

I can't seem to edit my question now but obviously, this issue is with Tensorflow 2.6, not 3.6 which doesn't exist yet.

It should be noted that with tensorflow-metal 0.3.0 the behavior is even more bizarre. Instead of the tail of the list being filled with -0s, it is now filled with random values.

Sorting bug caused by the TopK implementation tensorflow calls into is fixed in tensorflow-metal==0.5.1.

Sorting tf.float32 in Tensorflow
 
 
Q