Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
737fbdba
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2302
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看板
未验证
提交
737fbdba
编写于
12月 11, 2022
作者:
姜
姜永久
提交者:
GitHub
12月 12, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm unittests eager guard tests part5 dataloader2dygraph_mnist (#48816)
上级
f53e5a04
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
8 addition
and
91 deletion
+8
-91
python/paddle/fluid/tests/unittests/test_dataloader_dataset.py
...n/paddle/fluid/tests/unittests/test_dataloader_dataset.py
+3
-19
python/paddle/fluid/tests/unittests/test_deform_conv2d.py
python/paddle/fluid/tests/unittests/test_deform_conv2d.py
+0
-9
python/paddle/fluid/tests/unittests/test_deformable_conv_op.py
...n/paddle/fluid/tests/unittests/test_deformable_conv_op.py
+0
-9
python/paddle/fluid/tests/unittests/test_determinant_op.py
python/paddle/fluid/tests/unittests/test_determinant_op.py
+0
-5
python/paddle/fluid/tests/unittests/test_diag_v2.py
python/paddle/fluid/tests/unittests/test_diag_v2.py
+0
-5
python/paddle/fluid/tests/unittests/test_diagonal_op.py
python/paddle/fluid/tests/unittests/test_diagonal_op.py
+5
-11
python/paddle/fluid/tests/unittests/test_diff_op.py
python/paddle/fluid/tests/unittests/test_diff_op.py
+0
-7
python/paddle/fluid/tests/unittests/test_digamma_op.py
python/paddle/fluid/tests/unittests/test_digamma_op.py
+0
-12
python/paddle/fluid/tests/unittests/test_dist_base.py
python/paddle/fluid/tests/unittests/test_dist_base.py
+0
-11
python/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py
...n/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py
+0
-3
未找到文件。
python/paddle/fluid/tests/unittests/test_dataloader_dataset.py
浏览文件 @
737fbdba
...
...
@@ -17,12 +17,11 @@ import unittest
import
paddle
import
paddle.vision.transforms
as
transforms
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.io
import
Dataset
class
TestDatasetAbstract
(
unittest
.
TestCase
):
def
func_
test_main
(
self
):
def
test_main
(
self
):
dataset
=
Dataset
()
try
:
d
=
dataset
[
0
]
...
...
@@ -36,11 +35,6 @@ class TestDatasetAbstract(unittest.TestCase):
except
NotImplementedError
:
pass
def
test_main
(
self
):
with
_test_eager_guard
():
self
.
func_test_main
()
self
.
func_test_main
()
class
TestDatasetWithDiffOutputPlace
(
unittest
.
TestCase
):
def
get_dataloader
(
self
,
num_workers
):
...
...
@@ -68,7 +62,7 @@ class TestDatasetWithDiffOutputPlace(unittest.TestCase):
self
.
assertTrue
(
label
.
place
.
is_cpu_place
())
break
def
func_
test_single_process
(
self
):
def
test_single_process
(
self
):
self
.
run_check_on_cpu
()
if
paddle
.
is_compiled_with_cuda
():
# Get (image, label) tuple from MNIST dataset
...
...
@@ -80,12 +74,7 @@ class TestDatasetWithDiffOutputPlace(unittest.TestCase):
self
.
assertTrue
(
label
.
place
.
is_cuda_pinned_place
())
break
def
test_single_process
(
self
):
with
_test_eager_guard
():
self
.
func_test_single_process
()
self
.
func_test_single_process
()
def
func_test_multi_process
(
self
):
def
test_multi_process
(
self
):
# DataLoader with multi-process mode is not supported on MacOs and Windows currently
if
sys
.
platform
!=
'darwin'
and
sys
.
platform
!=
'win32'
:
self
.
run_check_on_cpu
()
...
...
@@ -99,11 +88,6 @@ class TestDatasetWithDiffOutputPlace(unittest.TestCase):
self
.
assertTrue
(
label
.
place
.
is_cuda_pinned_place
())
break
def
test_multi_process
(
self
):
with
_test_eager_guard
():
self
.
func_test_multi_process
()
self
.
func_test_multi_process
()
if
__name__
==
'__main__'
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_deform_conv2d.py
浏览文件 @
737fbdba
...
...
@@ -19,7 +19,6 @@ import numpy as np
import
paddle
import
paddle.nn.initializer
as
I
from
paddle.fluid.framework
import
_test_eager_guard
class
TestDeformConv2D
(
TestCase
):
...
...
@@ -233,10 +232,6 @@ class TestDeformConv2D(TestCase):
self
.
place
=
paddle
.
CUDAPlace
(
0
)
self
.
_test_identity
()
def
test_identity_with_eager_guard
(
self
):
with
_test_eager_guard
():
self
.
test_identity
()
class
TestDeformConv2DFunctional
(
TestCase
):
batch_size
=
4
...
...
@@ -544,10 +539,6 @@ class TestDeformConv2DFunctional(TestCase):
self
.
place
=
paddle
.
CUDAPlace
(
0
)
self
.
_test_identity
()
def
test_identity_with_eager_guard
(
self
):
with
_test_eager_guard
():
self
.
test_identity
()
# testcases for DeformConv2D
class
TestDeformConv2DWithPadding
(
TestDeformConv2D
):
...
...
python/paddle/fluid/tests/unittests/test_deformable_conv_op.py
浏览文件 @
737fbdba
...
...
@@ -18,7 +18,6 @@ import numpy as np
from
op_test
import
OpTest
import
paddle
from
paddle.fluid.framework
import
_test_eager_guard
paddle
.
enable_static
()
...
...
@@ -442,10 +441,6 @@ class TestModulatedDeformableConvInvalidInput(unittest.TestCase):
self
.
assertRaises
(
ValueError
,
test_invalid_filter
)
def
test_error_with_eager_guard
(
self
):
with
_test_eager_guard
():
self
.
test_error
()
class
TestDeformConv2DAPI
(
unittest
.
TestCase
):
def
test_api
(
self
):
...
...
@@ -484,10 +479,6 @@ class TestDeformConv2DAPI(unittest.TestCase):
test_deform_conv2d_v2
()
def
test_api_with_eager_guard
(
self
):
with
_test_eager_guard
():
self
.
test_api
()
if
__name__
==
'__main__'
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_determinant_op.py
浏览文件 @
737fbdba
...
...
@@ -18,7 +18,6 @@ import numpy as np
from
op_test
import
OpTest
import
paddle
from
paddle.fluid.framework
import
_test_eager_guard
paddle
.
enable_static
()
...
...
@@ -87,10 +86,6 @@ class TestDeterminantAPI(unittest.TestCase):
np
.
testing
.
assert_allclose
(
out
.
numpy
(),
out_ref
,
rtol
=
0.001
)
paddle
.
enable_static
()
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_api_dygraph
()
class
TestSlogDeterminantOp
(
OpTest
):
def
setUp
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_diag_v2.py
浏览文件 @
737fbdba
...
...
@@ -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
TestDiagV2Op
(
OpTest
):
...
...
@@ -281,8 +280,6 @@ class TestDiagV2API(unittest.TestCase):
def
test_cpu
(
self
):
paddle
.
disable_static
(
place
=
paddle
.
fluid
.
CPUPlace
())
self
.
run_imperative
()
with
_test_eager_guard
():
self
.
run_imperative
()
paddle
.
enable_static
()
...
...
@@ -295,8 +292,6 @@ class TestDiagV2API(unittest.TestCase):
paddle
.
disable_static
(
place
=
paddle
.
fluid
.
CUDAPlace
(
0
))
self
.
run_imperative
()
with
_test_eager_guard
():
self
.
run_imperative
()
paddle
.
enable_static
()
with
fluid
.
program_guard
(
fluid
.
Program
()):
...
...
python/paddle/fluid/tests/unittests/test_diagonal_op.py
浏览文件 @
737fbdba
...
...
@@ -18,7 +18,6 @@ import numpy as np
from
op_test
import
OpTest
import
paddle
from
paddle.fluid.framework
import
_test_eager_guard
paddle
.
enable_static
()
...
...
@@ -157,12 +156,11 @@ class TestDiagonalAPI(unittest.TestCase):
def
test_api_eager
(
self
):
paddle
.
disable_static
(
self
.
place
)
with
_test_eager_guard
():
x_tensor
=
paddle
.
to_tensor
(
self
.
x
)
out
=
paddle
.
diagonal
(
x_tensor
)
out2
=
paddle
.
diagonal
(
x_tensor
,
offset
=
0
,
axis1
=
2
,
axis2
=
1
)
out3
=
paddle
.
diagonal
(
x_tensor
,
offset
=
1
,
axis1
=
0
,
axis2
=
1
)
out4
=
paddle
.
diagonal
(
x_tensor
,
offset
=
0
,
axis1
=
1
,
axis2
=
2
)
x_tensor
=
paddle
.
to_tensor
(
self
.
x
)
out
=
paddle
.
diagonal
(
x_tensor
)
out2
=
paddle
.
diagonal
(
x_tensor
,
offset
=
0
,
axis1
=
2
,
axis2
=
1
)
out3
=
paddle
.
diagonal
(
x_tensor
,
offset
=
1
,
axis1
=
0
,
axis2
=
1
)
out4
=
paddle
.
diagonal
(
x_tensor
,
offset
=
0
,
axis1
=
1
,
axis2
=
2
)
out_ref
=
np
.
diagonal
(
self
.
x
)
np
.
testing
.
assert_allclose
(
out
.
numpy
(),
out_ref
,
rtol
=
1e-08
)
out2_ref
=
np
.
diagonal
(
self
.
x
,
offset
=
0
,
axis1
=
2
,
axis2
=
1
)
...
...
@@ -174,10 +172,6 @@ class TestDiagonalAPI(unittest.TestCase):
paddle
.
enable_static
()
def
test_api_eager_dygraph
(
self
):
with
_test_eager_guard
():
self
.
test_api_dygraph
()
if
__name__
==
'__main__'
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_diff_op.py
浏览文件 @
737fbdba
...
...
@@ -19,7 +19,6 @@ import numpy as np
import
paddle
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
from
paddle.fluid.framework
import
_test_eager_guard
class
TestDiffOp
(
unittest
.
TestCase
):
...
...
@@ -75,9 +74,6 @@ class TestDiffOp(unittest.TestCase):
self
.
assertTrue
((
out
.
numpy
()
==
self
.
output
).
all
(),
True
)
def
test_dygraph
(
self
):
with
_test_eager_guard
():
self
.
setUp
()
self
.
func_dygraph
()
self
.
setUp
()
self
.
func_dygraph
()
...
...
@@ -145,9 +141,6 @@ class TestDiffOp(unittest.TestCase):
raise
RuntimeError
(
"Check Diff Gradient Failed"
)
def
test_grad
(
self
):
with
_test_eager_guard
():
self
.
setUp
()
self
.
func_grad
()
self
.
setUp
()
self
.
func_grad
()
...
...
python/paddle/fluid/tests/unittests/test_digamma_op.py
浏览文件 @
737fbdba
...
...
@@ -21,7 +21,6 @@ from scipy.special import psi
import
paddle
import
paddle.fluid
as
fluid
import
paddle.static
as
static
from
paddle.fluid.framework
import
_test_eager_guard
class
TestDigammaOp
(
OpTest
):
...
...
@@ -95,10 +94,6 @@ class TestDigammaAPI(unittest.TestCase):
res
=
paddle
.
digamma
(
input_t
).
numpy
()
np
.
testing
.
assert_allclose
(
res
,
sc_res
,
rtol
=
1e-05
)
def
test_in_eager_dynamic_mode
(
self
):
with
_test_eager_guard
():
self
.
test_in_dynamic_mode
()
def
test_name_argument
(
self
):
with
static
.
program_guard
(
static
.
Program
()):
x
=
static
.
data
(
name
=
"x"
,
shape
=
self
.
_shape
,
dtype
=
self
.
dtypes
[
0
])
...
...
@@ -119,13 +114,6 @@ class TestDigammaAPI(unittest.TestCase):
input_t
=
paddle
.
to_tensor
(
input
)
res
=
paddle
.
digamma
(
input_t
)
with
self
.
assertRaises
(
RuntimeError
):
with
fluid
.
dygraph
.
guard
():
with
_test_eager_guard
():
input
=
np
.
random
.
random
(
self
.
_shape
).
astype
(
"int32"
)
input_t
=
paddle
.
to_tensor
(
input
)
res
=
paddle
.
digamma
(
input_t
)
if
__name__
==
"__main__"
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_dist_base.py
浏览文件 @
737fbdba
...
...
@@ -30,7 +30,6 @@ import paddle.fluid as fluid
import
paddle.fluid.dygraph
as
dygraph
import
paddle.fluid.incubate.fleet.base.role_maker
as
role_maker
from
paddle.fluid
import
compiler
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.fluid.incubate.fleet.collective
import
DistributedStrategy
,
fleet
RUN_STEP
=
5
...
...
@@ -1718,16 +1717,6 @@ class TestDistBase(unittest.TestCase):
log_name
=
""
,
):
if
self
.
_dygraph
and
(
self
.
_gloo_mode
or
self
.
_nccl2_mode
):
need_envs
.
update
({
"FLAGS_enable_eager_mode"
:
"1"
})
with
_test_eager_guard
():
self
.
check_with_place_func
(
model_file
=
model_file
,
delta
=
delta
,
check_error_log
=
check_error_log
,
need_envs
=
need_envs
,
log_name
=
log_name
,
)
need_envs
.
update
({
"FLAGS_enable_eager_mode"
:
"0"
})
self
.
check_with_place_func
(
model_file
=
model_file
,
delta
=
delta
,
...
...
python/paddle/fluid/tests/unittests/test_dygraph_mnist_fp16.py
浏览文件 @
737fbdba
...
...
@@ -18,7 +18,6 @@ import numpy as np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid.framework
import
_test_eager_guard
from
paddle.nn
import
Linear
...
...
@@ -136,8 +135,6 @@ class TestMnist(unittest.TestCase):
print
(
loss
.
numpy
())
def
test_mnist_fp16
(
self
):
with
_test_eager_guard
():
self
.
func_mnist_fp16
()
self
.
func_mnist_fp16
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录