my_array is defined as a constant tensor with these values:
<tf.Tensor: shape=(20,), dtype=float32, numpy=
array([0.39002007, 0.6232998 , 0.65246916, 0.51837456, 0.32046252,
0.17287847, 0.1020941 , 0.05556634, 0.03855091, 0.04841335,
0.08809784, 0.17805861, 0.29818463, 0.48202834, 0.63666624,
0.68172085, 0.66695976, 0.64094126, 0.6494308 , 0.66173404],
dtype=float32)>
tf.sort(my_array) returns the following tensor:
<tf.Tensor: shape=(20,), dtype=float32, numpy=
array([ 0.03855091, 0.04841335, 0.05556634, 0.08809784, 0.1020941 ,
0.17287847, 0.17805861, 0.29818463, 0.32046252, 0.39002007,
0.48202834, 0.51837456, 0.6232998 , 0.63666624, 0.64094126,
0.6494308 , -0. , -0. , -0. , -0. ],
dtype=float32)>
Only the first 16 elements are sorted. The same behavior occurs with argsort. When casting to float64 the error disappears.
I installed tensorflow following https://developer.apple.com/metal/tensorflow-plugin/
Is this a bug?
-
—
muxamilian
-
—
muxamilian
-
—
be2112
Add a CommentStill persists in tensorflow 2.6.0.
Persists in
tensorflow-metal==0.3.0I've got the same issue. For what its worth, casting to float16 works as well. The issue also only occurs when the tensor is on the GPU. If you move the tensor to the CPU, then sort, sorting works as expected.