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 2 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, perm, rhs, validate_args=False, name=None):
return ivy.solve(lower_upper, perm, rhs, validate_args=False, name=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

ivy.solve() takes on 2 arguments, also I'd suggest you should read the docstring on how does this function work.
I'd suggest you implement this compositionally for now. If you don't know what compositionally means I'd refer you to our deep dive in the docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't find any information like this in the deep dive doc, please. Can you help?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zaeemansari70 Please check what I just did!

27 changes: 27 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,30 @@ 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(
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,
):
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,
input=input[0],
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not expecting input as an argument according to the function definintion.
You have to handle lower_upper, perm, rhs, validate_args for it to work

)
Loading