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

logdet Pytorch Frontend tensor.py #14782

Closed
wants to merge 2 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
4 changes: 4 additions & 0 deletions ivy/functional/frontends/torch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1020,3 +1020,7 @@ def square(self):
@with_unsupported_dtypes({"1.11.0 and below": ("float16",)}, "torch")
def log10(self):
return torch_frontend.log10(self._ivy_array)

@with_unsupported_dtypes({"1.11.0 and below": ("float16", "bfloat16")}, "torch")
def logdet(self):
return torch_frontend.log(torch_frontend.det(self))
31 changes: 31 additions & 0 deletions ivy_tests/test_ivy/test_frontends/test_torch/test_tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7321,3 +7321,34 @@ def test_torch_instance_log10(
frontend=frontend,
on_device=on_device,
)


# logdet
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="torch.tensor",
method_name="logdet",
dtype_and_x=_get_dtype_and_square_matrix(),
)
def test_torch_instance_logdet(
dtype_and_x,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_all_as_kwargs_np={
"data": x,
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)