Skip to content

Commit

Permalink
ivy-llc#7081 torch.tensor.ceil added to frontend (ivy-llc#7133)
Browse files Browse the repository at this point in the history
Co-authored-by: MichaelTito1 <maicheltito1@gmail.com>, nassimberrada
  • Loading branch information
MichaelTito1 authored and KevinUnadkat committed Dec 4, 2022
1 parent db76f41 commit c1f51f4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ivy/functional/frontends/torch/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,9 @@ def pow_(self, other):
def argmax(self, dim=None, keepdim=False):
return torch_frontend.argmax(self.data, dim=dim, keepdim=keepdim)

def ceil(self):
return torch_frontend.ceil(self.data)

# Special Methods #
# -------------------#

Expand Down
33 changes: 33 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 @@ -2796,3 +2796,36 @@ def test_torch_instance_argmax(
class_name="tensor",
method_name="argmax",
)


@handle_frontend_method(
method_tree="torch.tensor.ceil",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
),
)
def test_torch_instance_ceil(
dtype_and_x,
as_variable,
native_array,
class_,
method_name,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_as_variable_flags=as_variable,
init_num_positional_args=1,
init_native_array_flags=native_array,
init_all_as_kwargs_np={
"data": x[0],
},
method_input_dtypes=input_dtype,
method_as_variable_flags=as_variable,
method_num_positional_args=0,
method_native_array_flags=native_array,
method_all_as_kwargs_np={},
frontend="torch",
class_="tensor",
method_name="ceil",
)

0 comments on commit c1f51f4

Please sign in to comment.