Skip to content

Commit

Permalink
close paddle frontend instance cumprod issue #17656 (#17889)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosesdaudu001 authored Jun 27, 2023
1 parent 81c6808 commit 41633b7
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,7 @@ def greater_than(self, y, name=None):
@with_supported_dtypes({"2.5.0 and below": ("float32", "float64")}, "paddle")
def rsqrt(self, name=None):
return ivy.reciprocal(ivy.sqrt(self._ivy_array))

@with_unsupported_dtypes({"2.5.0 and below": ("float16", "bfloat16")}, "paddle")
def cumprod(self, dim=None, dtype=None, name=None):
return ivy.cumprod(self._ivy_array, axis=dim, dtype=dtype)
Original file line number Diff line number Diff line change
Expand Up @@ -1448,3 +1448,40 @@ def test_paddle_greater_than(
frontend=frontend,
on_device=on_device,
)


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="cumprod",
dtype_x_axis=helpers.dtype_values_axis(
available_dtypes=helpers.get_dtypes("float"),
valid_axis=True,
force_int_axis=True,
min_num_dims=1,
min_value=-5,
max_value=5,
),
)
def test_paddle_cumprod(
dtype_x_axis,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
):
input_dtype, x, axis = dtype_x_axis
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_all_as_kwargs_np={
"data": x[0],
},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={"dim": axis},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)

0 comments on commit 41633b7

Please sign in to comment.