Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added the lu_solve function #21981

Closed
wants to merge 3 commits into from
Closed
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
5 changes: 5 additions & 0 deletions ivy/functional/frontends/tensorflow/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,3 +470,8 @@ def tensor_diag_part(input, name=None):
reshaped = ivy.reshape(input, (prod, prod))
diagonal = ivy.diagonal(reshaped)
return ivy.reshape(diagonal, tuple(half_shape))


@to_ivy_arrays_and_back
def lu_solve(lower_upper, rhs): # ToDO
Copy link
Contributor

Choose a reason for hiding this comment

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

The function definition should be all the arguments present here https://www.tensorflow.org/api_docs/python/tf/linalg/lu_solve

return ivy.solve(lower_upper, rhs)
Copy link
Contributor

Choose a reason for hiding this comment

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

30 changes: 30 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_tensorflow/test_linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,3 +1239,33 @@ def test_tensorflow_tensor_diag_part(
on_device=on_device,
input=input[0],
)


# Tests for tensorflow.linalg.lu_solve function's frontend
@handle_frontend_test( # ToDo
fn_tree="tensorflow.linalg.lu_solve",
dtype_and_input=_get_dtype_and_rank_2k_tensors(),
test_with_out=st.just(False),
)
def test_tensorflow_linalg_lu_solve(
*,
dtype_and_input,
frontend,
test_flags,
fn_tree,
on_device,
backend_fw,
lower_upper,
rhs,
):
dtype, input = dtype_and_input
helpers.test_frontend_function(
input_dtypes=dtype,
frontend=frontend,
backend_to_test=backend_fw,
test_flags=test_flags,
fn_tree=fn_tree,
on_device=on_device,
lower_upper=lower_upper,
rhs=rhs,
)
Loading