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

Torch instance method: amin #5898

Merged
merged 2 commits into from
Oct 24, 2022
Merged
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
3 changes: 3 additions & 0 deletions ivy/functional/frontends/torch/Tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def log(self):
def amax(self, dim=None, keepdim=False):
return torch_frontend.amax(self.data, dim=dim, keepdim=keepdim)

def amin(self, dim=None, keepdim=False):
return torch_frontend.amin(self.data, dim=dim, keepdim=keepdim)

def abs(self, *, out=None):
return torch_frontend.abs(self.data, out=out)

Expand Down
32 changes: 32 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 @@ -659,6 +659,38 @@ def test_torch_instance_abs_(
)


# amin
@handle_cmd_line_args
@given(
dtype_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid", full=True),
),
)
def test_torch_instance_amin(
dtype_x,
as_variable,
native_array,
):
input_dtype, x = dtype_x
helpers.test_frontend_method(
input_dtypes_init=input_dtype,
as_variable_flags_init=as_variable,
num_positional_args_init=1,
native_array_flags_init=native_array,
all_as_kwargs_np_init={
"data": x[0],
},
input_dtypes_method=input_dtype,
as_variable_flags_method=as_variable,
num_positional_args_method=0,
native_array_flags_method=native_array,
all_as_kwargs_np_method={},
frontend="torch",
class_name="tensor",
method_name="amin",
)


# contiguous
@handle_cmd_line_args
@given(
Expand Down