Skip to content

keras.ops.sort(axis=None) fails on eager tensors instead of flattening and sorting #22543

@AGFACBNNR

Description

@AGFACBNNR

Summary

keras.ops.sort with axis=None is documented to flatten the tensor before sorting, but on TensorFlow eager tensors it raises an error.

Reproduction

import keras
import tensorflow as tf

x = tf.constant([[[1, 4, 3], [9, 7, 6]]], dtype=tf.float32)
print(keras.ops.sort(x, axis=None))

Expected result

The tensor should be flattened and returned in ascending order.

Actual result

An exception is raised:

Attempt to convert a value (None) with an unsupported type (<class 'NoneType'>) to a Tensor.

Notes

The same API call with a keras.Input placeholder does not raise this error, so the issue appears specific to eager execution.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions