Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Boghdady9 committed Sep 13, 2023
1 parent 79dadcc commit 29ce795
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
6 changes: 2 additions & 4 deletions ivy/functional/frontends/paddle/tensor/tensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,5 @@ def is_floating_point(self):
@with_supported_dtypes(
{"2.5.1 and below": ("float32", "float64", "int32", "int64")}, "paddle"
)
def backward(self, x, grad_tensor=None, retain_graph=False):
return paddle_frontend.Tensor.backward(
x, grad_tensor=grad_tensor, retain_graph=retain_graph
)
def backward(self, x):
return paddle_frontend.Tensor.backward(self.x)
Original file line number Diff line number Diff line change
Expand Up @@ -3696,23 +3696,18 @@ def test_paddle_tensor_zero_(


# backward


@handle_frontend_method(
class_tree=CLASS_TREE,
init_tree="paddle.to_tensor",
method_name="backward",
dtype_and_x=helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
),
grad_tensor=st.none()
| helpers.dtype_and_values(
available_dtypes=helpers.get_dtypes("float"),
),
retain_graph=st.booleans(),
)
def test_paddle_backward(
dtype_and_x,
grad_tensor,
retain_graph,
frontend_method_data,
init_flags,
method_flags,
Expand All @@ -3721,16 +3716,13 @@ def test_paddle_backward(
backend_fw,
):
input_dtype, x = dtype_and_x

x = Tensor(x)
helpers.test_frontend_method(
init_input_dtypes=input_dtype,
init_all_as_kwargs_np={"data": x},
init_all_as_kwargs_np={"x": x},
method_all_as_kwargs_np={"x": x},
method_input_dtypes=input_dtype,
method_all_as_kwargs_np={
"grad_tensor": grad_tensor,
"retain_graph": retain_graph,
"backend_to_test": backend_fw,
},
backend_to_test=backend_fw,
frontend_method_data=frontend_method_data,
init_flags=init_flags,
method_flags=method_flags,
Expand Down

0 comments on commit 29ce795

Please sign in to comment.