-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(paddle): Add backward method to Paddle Frontend #23549
Changes from all commits
28f4c81
e43821d
79dadcc
29ce795
b5704b2
d39d9b5
6b4b5c4
f8b3ac9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -283,6 +283,42 @@ def test_paddle__reshape( | |
) | ||
|
||
|
||
# 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"), | ||
), | ||
) | ||
def test_paddle_backward( | ||
dtype_and_x, | ||
frontend_method_data, | ||
init_flags, | ||
method_flags, | ||
frontend, | ||
on_device, | ||
backend_fw, | ||
): | ||
input_dtype, x = dtype_and_x | ||
x = Tensor(x) | ||
helpers.test_frontend_method( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @AnnaTz |
||
init_input_dtypes=input_dtype, | ||
init_all_as_kwargs_np={"x": x}, | ||
method_all_as_kwargs_np={"x": x}, | ||
method_input_dtypes=input_dtype, | ||
backend_to_test=backend_fw, | ||
frontend_method_data=frontend_method_data, | ||
init_flags=init_flags, | ||
method_flags=method_flags, | ||
frontend=frontend, | ||
on_device=on_device, | ||
) | ||
|
||
|
||
# atan | ||
@handle_frontend_method( | ||
class_tree=CLASS_TREE, | ||
|
@@ -908,6 +944,40 @@ def test_paddle_tensor_astype( | |
) | ||
|
||
|
||
# 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"), | ||
), | ||
) | ||
def test_paddle_tensor_backward( | ||
dtype_and_x, | ||
frontend_method_data, | ||
init_flags, | ||
method_flags, | ||
frontend, | ||
on_device, | ||
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={"x": x}, | ||
method_all_as_kwargs_np={"x": x}, | ||
method_input_dtypes=input_dtype, | ||
backend_to_test=backend_fw, | ||
frontend_method_data=frontend_method_data, | ||
init_flags=init_flags, | ||
method_flags=method_flags, | ||
frontend=frontend, | ||
on_device=on_device, | ||
) | ||
|
||
|
||
# bitwise_and | ||
@handle_frontend_method( | ||
class_tree=CLASS_TREE, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename the test to
test_paddle_tensor_backward
to be in line with our naming convention.