Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
d808f160
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
d808f160
编写于
12月 14, 2022
作者:
姜
姜永久
提交者:
GitHub
12月 15, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm eager guard tests part3_1 (#49059)
上级
d0fefa23
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
16 addition
and
54 deletion
+16
-54
python/paddle/fluid/tests/unittests/test_cast_op.py
python/paddle/fluid/tests/unittests/test_cast_op.py
+9
-11
python/paddle/fluid/tests/unittests/test_clip_op.py
python/paddle/fluid/tests/unittests/test_clip_op.py
+7
-14
python/paddle/fluid/tests/unittests/test_complex_abs.py
python/paddle/fluid/tests/unittests/test_complex_abs.py
+0
-5
python/paddle/fluid/tests/unittests/test_complex_cast.py
python/paddle/fluid/tests/unittests/test_complex_cast.py
+0
-7
python/paddle/fluid/tests/unittests/test_complex_elementwise_layers.py
.../fluid/tests/unittests/test_complex_elementwise_layers.py
+0
-7
python/paddle/fluid/tests/unittests/test_complex_getitem.py
python/paddle/fluid/tests/unittests/test_complex_getitem.py
+0
-10
未找到文件。
python/paddle/fluid/tests/unittests/test_cast_op.py
浏览文件 @
d808f160
...
...
@@ -24,7 +24,6 @@ import paddle.fluid as fluid
import
paddle.fluid.core
as
core
import
paddle.fluid.layers
as
layers
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid.framework
import
_test_eager_guard
class
TestCastOpFp32ToFp64
(
OpTest
):
...
...
@@ -122,16 +121,15 @@ class TestCastOpError(unittest.TestCase):
class
TestCastOpEager
(
unittest
.
TestCase
):
def
test_eager
(
self
):
with
paddle
.
fluid
.
dygraph
.
base
.
guard
():
with
_test_eager_guard
():
x
=
paddle
.
ones
([
2
,
2
],
dtype
=
"float16"
)
x
.
stop_gradient
=
False
out
=
paddle
.
cast
(
x
,
"float32"
)
np
.
testing
.
assert_array_equal
(
out
,
np
.
ones
([
2
,
2
]).
astype
(
'float32'
)
)
out
.
backward
()
np
.
testing
.
assert_array_equal
(
x
.
gradient
(),
x
.
numpy
())
self
.
assertTrue
(
x
.
gradient
().
dtype
==
np
.
float16
)
x
=
paddle
.
ones
([
2
,
2
],
dtype
=
"float16"
)
x
.
stop_gradient
=
False
out
=
paddle
.
cast
(
x
,
"float32"
)
np
.
testing
.
assert_array_equal
(
out
,
np
.
ones
([
2
,
2
]).
astype
(
'float32'
)
)
out
.
backward
()
np
.
testing
.
assert_array_equal
(
x
.
gradient
(),
x
.
numpy
())
self
.
assertTrue
(
x
.
gradient
().
dtype
==
np
.
float16
)
class
TestCastDoubleGradCheck
(
unittest
.
TestCase
):
...
...
python/paddle/fluid/tests/unittests/test_clip_op.py
浏览文件 @
d808f160
...
...
@@ -20,7 +20,6 @@ from op_test import OpTest
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid.framework
import
_test_eager_guard
class
TestClipOp
(
OpTest
):
...
...
@@ -231,7 +230,7 @@ class TestClipAPI(unittest.TestCase):
)
paddle
.
disable_static
()
def
func
_clip_dygraph
(
self
):
def
test
_clip_dygraph
(
self
):
paddle
.
disable_static
()
place
=
(
fluid
.
CUDAPlace
(
0
)
...
...
@@ -279,20 +278,14 @@ class TestClipAPI(unittest.TestCase):
out_6
.
numpy
(),
data
.
clip
(
0.2
,
0.8
),
rtol
=
1e-05
)
def
test_clip_dygraph
(
self
):
with
_test_eager_guard
():
self
.
func_clip_dygraph
()
self
.
func_clip_dygraph
()
def
test_clip_dygraph_default_max
(
self
):
paddle
.
disable_static
()
with
_test_eager_guard
():
x_int32
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"int32"
)
x_int64
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"int64"
)
x_f32
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"float32"
)
egr_out1
=
paddle
.
clip
(
x_int32
,
min
=
1
)
egr_out2
=
paddle
.
clip
(
x_int64
,
min
=
1
)
egr_out3
=
paddle
.
clip
(
x_f32
,
min
=
1
)
x_int32
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"int32"
)
x_int64
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"int64"
)
x_f32
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"float32"
)
egr_out1
=
paddle
.
clip
(
x_int32
,
min
=
1
)
egr_out2
=
paddle
.
clip
(
x_int64
,
min
=
1
)
egr_out3
=
paddle
.
clip
(
x_f32
,
min
=
1
)
x_int32
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"int32"
)
x_int64
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"int64"
)
x_f32
=
paddle
.
to_tensor
([
1
,
2
,
3
],
dtype
=
"float32"
)
...
...
python/paddle/fluid/tests/unittests/test_complex_abs.py
浏览文件 @
d808f160
...
...
@@ -19,7 +19,6 @@ from op_test import OpTest
import
paddle
import
paddle.fluid.dygraph
as
dg
from
paddle.fluid.framework
import
_test_eager_guard
class
TestComplexAbsOp
(
OpTest
):
...
...
@@ -109,10 +108,6 @@ class TestAbs(unittest.TestCase):
y
=
paddle
.
abs
(
paddle
.
to_tensor
(
x
))
np
.
testing
.
assert_allclose
(
np
.
abs
(
x
),
y
.
numpy
(),
rtol
=
1e-05
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_all_positive
()
class
TestRealAbsOp
(
OpTest
):
def
setUp
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_complex_cast.py
浏览文件 @
d808f160
...
...
@@ -17,7 +17,6 @@ import unittest
import
numpy
as
np
import
paddle
from
paddle.fluid.framework
import
_test_eager_guard
class
TestComplexCastOp
(
unittest
.
TestCase
):
...
...
@@ -80,12 +79,6 @@ class TestComplexCastOp(unittest.TestCase):
c_128
.
cast
(
'complex128'
).
numpy
(),
c_64
.
numpy
(),
rtol
=
1e-05
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_complex64_complex128
()
self
.
test_real_to_complex
()
self
.
test_complex_to_real
()
if
__name__
==
'__main__'
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_complex_elementwise_layers.py
浏览文件 @
d808f160
...
...
@@ -20,7 +20,6 @@ from numpy.random import random as rand
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.dygraph
as
dg
from
paddle.fluid.framework
import
_test_eager_guard
paddle_apis
=
{
"add"
:
paddle
.
add
,
...
...
@@ -112,12 +111,6 @@ class TestComplexElementwiseLayers(unittest.TestCase):
self
.
compare_by_basic_api
(
x
,
y
)
self
.
compare_op_by_basic_api
(
x
,
y
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_real_x_complex_y
()
self
.
test_complex_x_real_y
()
self
.
test_complex_xy
()
if
__name__
==
'__main__'
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_complex_getitem.py
浏览文件 @
d808f160
...
...
@@ -18,7 +18,6 @@ import numpy as np
import
paddle.fluid
as
fluid
import
paddle.fluid.dygraph
as
dg
from
paddle.fluid.framework
import
_test_eager_guard
class
TestComplexGetitemLayer
(
unittest
.
TestCase
):
...
...
@@ -95,15 +94,6 @@ class TestComplexGetitemLayer(unittest.TestCase):
np
.
testing
.
assert_allclose
(
x_var_slice
.
numpy
(),
x_np_slice
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_case1
()
self
.
test_case2
()
self
.
test_case3
()
self
.
test_case4
()
self
.
test_case5
()
self
.
test_case6
()
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录