From 4c14a36dbc5eaefd3046f8bd6380c77588e31ea5 Mon Sep 17 00:00:00 2001 From: yangguohao <1901212980@pku.edu.cn> Date: Wed, 8 Nov 2023 11:32:45 +0800 Subject: [PATCH] 2023-11-08 --- python/paddle/tensor/ops.py | 9 ++++++++- test/legacy_test/op_test.py | 4 +++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/python/paddle/tensor/ops.py b/python/paddle/tensor/ops.py index e3fec0ee5fc842..140f53f038c723 100644 --- a/python/paddle/tensor/ops.py +++ b/python/paddle/tensor/ops.py @@ -1063,7 +1063,14 @@ def sqrt(x, name=None): check_variable_and_dtype( x, 'x', - ['float16', 'uint16', 'float32', 'float64'], + [ + 'float16', + 'uint16', + 'float32', + 'float64', + 'complex64', + 'complex128', + ], 'sqrt', ) helper = LayerHelper('sqrt', **locals()) diff --git a/test/legacy_test/op_test.py b/test/legacy_test/op_test.py index b181e549eed7cd..c89851de13b382 100644 --- a/test/legacy_test/op_test.py +++ b/test/legacy_test/op_test.py @@ -1732,7 +1732,9 @@ def _dfs_grad_op(op_desc, fwd_op_desc=None): has_infer_inplace = base.core.has_infer_inplace(op_desc.type()) has_grad_op_maker = base.core.has_grad_op_maker(op_desc.type()) has_infer_inplace_in_grad_descendants = False - if not has_grad_op_maker: + # the OP test doesn't support higher order grad + is_grad_op_desc = op_desc.type().endswith('_grad') + if not has_grad_op_maker or is_grad_op_desc: has_infer_inplace_in_descendants = False else: # get grad_op_desc