未验证 提交 641ce65f 编写于 作者: Z zyfncg 提交者: GitHub

add rsqrt yaml and unittest (#41443)

上级 d39e7896
...@@ -1023,6 +1023,7 @@ class TestSqrtBF16(OpTest): ...@@ -1023,6 +1023,7 @@ class TestSqrtBF16(OpTest):
class TestRsqrt(TestActivation): class TestRsqrt(TestActivation):
def setUp(self): def setUp(self):
self.op_type = "rsqrt" self.op_type = "rsqrt"
self.python_api = paddle.rsqrt
self.init_dtype() self.init_dtype()
np.random.seed(1024) np.random.seed(1024)
...@@ -1035,7 +1036,8 @@ class TestRsqrt(TestActivation): ...@@ -1035,7 +1036,8 @@ class TestRsqrt(TestActivation):
def test_check_grad(self): def test_check_grad(self):
if self.dtype == np.float16: if self.dtype == np.float16:
return return
self.check_grad(['X'], 'Out', max_relative_error=0.0005) self.check_grad(
['X'], 'Out', max_relative_error=0.0005, check_eager=True)
class TestAbs(TestActivation): class TestAbs(TestActivation):
......
...@@ -1544,6 +1544,16 @@ ...@@ -1544,6 +1544,16 @@
func : round func : round
backward : round_grad backward : round_grad
- api : rsqrt
args : (Tensor x)
output : Tensor(out)
infer_meta :
func : UnchangedInferMeta
kernel :
func : rsqrt
inplace : (x -> out)
backward : rsqrt_grad
- api : scale - api : scale
args : (Tensor x, Scalar scale, float bias, bool bias_after_scale) args : (Tensor x, Scalar scale, float bias, bool bias_after_scale)
output : Tensor output : Tensor
......
...@@ -1133,6 +1133,16 @@ ...@@ -1133,6 +1133,16 @@
kernel : kernel :
func : round_grad func : round_grad
- backward_api : rsqrt_grad
forward : rsqrt (Tensor x) -> Tensor(out)
args : (Tensor out, Tensor out_grad)
output : Tensor(x_grad)
infer_meta :
func : UnchangedInferMeta
param : [out]
kernel :
func : rsqrt_grad
- backward_api : scale_grad - backward_api : scale_grad
forward : scale (Tensor x, Scalar scale, float bias, bool bias_after_scale) -> Tensor(out) forward : scale (Tensor x, Scalar scale, float bias, bool bias_after_scale) -> Tensor(out)
args : (Tensor out_grad, Scalar scale=1.0, float bias=0.0, bool bias_after_scale=true) args : (Tensor out_grad, Scalar scale=1.0, float bias=0.0, bool bias_after_scale=true)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册