Skip to content

Commit

Permalink
added divide method to paddle tensor
Browse files Browse the repository at this point in the history
  • Loading branch information
samthakur587 committed Jun 27, 2023
1 parent 0b88f49 commit 67a68ca
Show file tree
Hide file tree
Showing 2 changed files with 39 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 divide(x, y, name=None):
return paddle_frontend.divide(x, y)
Original file line number Diff line number Diff line change
Expand Up @@ -1448,3 +1448,38 @@ def test_paddle_greater_than(
frontend=frontend,
on_device=on_device,
)


# greater_than
@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="divde",
dtypes_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("valid"),
num_arrays=2,
shared_dtype=True,
safety_factor_scale="log",
small_abs_safety_factor=32,
),
)
def test_paddle_divide(
dtypes_and_x,
frontend_method_data,
init_flags,
method_flags,
frontend,
on_device,
):
input_dtype, x = dtypes_and_x
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={"y": x[1]},
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
frontend=frontend,
on_device=on_device,
)

0 comments on commit 67a68ca

Please sign in to comment.