Skip to content

Commit

Permalink
add_n (ivy-llc#25991)
Browse files Browse the repository at this point in the history
  • Loading branch information
imsoumya18 authored and druvdub committed Oct 14, 2023
1 parent b0c5dc1 commit 71e6c9b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,11 @@ def abs(self):
def acosh(self, name=None):
return paddle_frontend.acosh(self)

@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
def add_n(self, inputs, name=None):
inputs = ivy.array(inputs)
return ivy.sum(inputs, dtype=inputs.dtype, axis=0)

@with_unsupported_dtypes({"2.5.1 and below": ("float16", "bfloat16")}, "paddle")
def ceil(self):
return paddle_frontend.ceil(self)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,40 @@ def test_paddle_tensor_add_(
)


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="add_n",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
num_arrays=helpers.ints(min_value=1, max_value=5),
shared_dtype=True,
),
)
def test_paddle_tensor_add_n(
dtype_and_x,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
backend_fw,
):
input_dtype, x = dtype_and_x
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
backend_to_test=backend_fw,
init_all_as_kwargs_np={"inputs": x},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={"inputs": x},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)


# all
@handle_frontend_method(
class_tree=CLASS_TREE,
Expand Down

0 comments on commit 71e6c9b

Please sign in to comment.