Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions keras/api/ops/core/quantile_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import numpy as np
import tensorflow as tf
from keras import ops

def test_quantile_graph_mode():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test already exists:

def test_quantile_in_tf_function(self):

Can you remove this file and modify the existing test to cover the case that was not working?

@tf.function
def run_quantile():
x = np.array([[1, 2, 3], [4, 5, 6]])
q = [0.5]
return ops.quantile(x, q, axis=1)

result = run_quantile()
expected = np.array([[2, 5]])
np.testing.assert_allclose(result, expected)
2 changes: 1 addition & 1 deletion keras/src/backend/tensorflow/numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2301,7 +2301,7 @@ def _get_indices(method):
return gathered_y
perm = collections.deque(range(ndims))
perm.rotate(shift_value_static)
return tf.transpose(a=gathered_y, perm=perm)
return tf.transpose(a=gathered_y, perm=list(perm))


def quantile(x, q, axis=None, method="linear", keepdims=False):
Expand Down
Loading