Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
f2c59b88
P
Paddle
项目概览
PaddlePaddle
/
Paddle
1 年多 前同步成功
通知
2305
Star
20932
Fork
5423
代码
文件
提交
分支
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看板
未验证
提交
f2c59b88
编写于
12月 12, 2022
作者:
姜
姜永久
提交者:
GitHub
12月 13, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
rm unittests eager guard tests part23 where2zeros (#48895)
上级
ee4a20cc
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
7 addition
and
87 deletion
+7
-87
python/paddle/fluid/tests/unittests/test_where_op.py
python/paddle/fluid/tests/unittests/test_where_op.py
+0
-17
python/paddle/fluid/tests/unittests/test_yolo_box_op.py
python/paddle/fluid/tests/unittests/test_yolo_box_op.py
+0
-5
python/paddle/fluid/tests/unittests/test_zeropad2d.py
python/paddle/fluid/tests/unittests/test_zeropad2d.py
+6
-37
python/paddle/fluid/tests/unittests/test_zeros_like_op.py
python/paddle/fluid/tests/unittests/test_zeros_like_op.py
+1
-13
python/paddle/fluid/tests/unittests/test_zeros_op.py
python/paddle/fluid/tests/unittests/test_zeros_op.py
+0
-15
未找到文件。
python/paddle/fluid/tests/unittests/test_where_op.py
浏览文件 @
f2c59b88
...
...
@@ -21,7 +21,6 @@ import paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid.backward
import
append_backward
from
paddle.fluid.framework
import
_test_eager_guard
class
TestWhereOp
(
OpTest
):
...
...
@@ -356,18 +355,6 @@ class TestWhereDygraphAPI(unittest.TestCase):
expect_out
=
np
.
array
([[
0
],
[
1
]])
np
.
testing
.
assert_allclose
(
expect_out
,
np
.
array
(
res
),
rtol
=
1e-05
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_api
()
self
.
test_dygraph_api_broadcast_1
()
self
.
test_dygraph_api_broadcast_2
()
self
.
test_dygraph_api_broadcast_3
()
self
.
test_dygraph_api_broadcast_4
()
self
.
test_dygraph_api_broadcast_5
()
self
.
test_dygraph_api_broadcast_6
()
self
.
test_dygraph_api_broadcast_7
()
self
.
test_dygraph_api_broadcast_8
()
class
TestWhereOpError
(
unittest
.
TestCase
):
def
test_errors
(
self
):
...
...
@@ -397,10 +384,6 @@ class TestWhereOpError(unittest.TestCase):
a
=
paddle
.
rand
(
cond_shape
)
self
.
assertRaises
(
ValueError
,
paddle
.
where
,
cond
,
a
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_value_error
()
if
__name__
==
"__main__"
:
paddle
.
enable_static
()
...
...
python/paddle/fluid/tests/unittests/test_yolo_box_op.py
浏览文件 @
f2c59b88
...
...
@@ -18,7 +18,6 @@ import numpy as np
from
op_test
import
OpTest
import
paddle
from
paddle.fluid.framework
import
_test_eager_guard
def
sigmoid
(
x
):
...
...
@@ -235,10 +234,6 @@ class TestYoloBoxDygraph(unittest.TestCase):
)
paddle
.
enable_static
()
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_dygraph
()
class
TestYoloBoxStatic
(
unittest
.
TestCase
):
def
test_static
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_zeropad2d.py
浏览文件 @
f2c59b88
...
...
@@ -16,7 +16,6 @@ import unittest
import
numpy
as
np
import
paddle
from
paddle
import
to_tensor
from
paddle.nn
import
ZeroPad2D
from
paddle.nn.functional
import
zeropad2d
...
...
@@ -34,7 +33,7 @@ class TestZeroPad2dAPIError(unittest.TestCase):
self
.
shape
=
[
4
,
3
,
224
,
224
]
self
.
unsupport_dtypes
=
[
'bool'
,
'int8'
]
def
func
_unsupport_dtypes
(
self
):
def
test
_unsupport_dtypes
(
self
):
"""
test unsupport dtypes.
"""
...
...
@@ -44,11 +43,6 @@ class TestZeroPad2dAPIError(unittest.TestCase):
x_tensor
=
to_tensor
(
x
).
astype
(
dtype
)
self
.
assertRaises
(
TypeError
,
zeropad2d
,
x
=
x_tensor
,
padding
=
pad
)
def
test_unsupport_dtypes
(
self
):
with
paddle
.
fluid
.
framework
.
_test_eager_guard
():
self
.
func_unsupport_dtypes
()
self
.
func_unsupport_dtypes
()
class
TestZeroPad2dAPI
(
unittest
.
TestCase
):
"""
...
...
@@ -62,7 +56,7 @@ class TestZeroPad2dAPI(unittest.TestCase):
self
.
shape
=
[
4
,
3
,
224
,
224
]
self
.
support_dtypes
=
[
'float32'
,
'float64'
,
'int32'
,
'int64'
]
def
func
_support_dtypes
(
self
):
def
test
_support_dtypes
(
self
):
"""
test support types
"""
...
...
@@ -75,12 +69,7 @@ class TestZeroPad2dAPI(unittest.TestCase):
ret_res
=
zeropad2d
(
x_tensor
,
[
pad
,
pad
,
pad
,
pad
]).
numpy
()
np
.
testing
.
assert_allclose
(
expect_res
,
ret_res
,
rtol
=
1e-05
)
def
test_support_dtypes
(
self
):
with
paddle
.
fluid
.
framework
.
_test_eager_guard
():
self
.
func_support_dtypes
()
self
.
func_support_dtypes
()
def
func_support_pad2
(
self
):
def
test_support_pad2
(
self
):
"""
test the type of 'pad' is list.
"""
...
...
@@ -94,12 +83,7 @@ class TestZeroPad2dAPI(unittest.TestCase):
ret_res
=
zeropad2d
(
x_tensor
,
pad
).
numpy
()
np
.
testing
.
assert_allclose
(
expect_res
,
ret_res
,
rtol
=
1e-05
)
def
test_support_pad2
(
self
):
with
paddle
.
fluid
.
framework
.
_test_eager_guard
():
self
.
func_support_pad2
()
self
.
func_support_pad2
()
def
func_support_pad3
(
self
):
def
test_support_pad3
(
self
):
"""
test the type of 'pad' is tuple.
"""
...
...
@@ -113,12 +97,7 @@ class TestZeroPad2dAPI(unittest.TestCase):
ret_res
=
zeropad2d
(
x_tensor
,
pad
).
numpy
()
np
.
testing
.
assert_allclose
(
expect_res
,
ret_res
,
rtol
=
1e-05
)
def
test_support_pad3
(
self
):
with
paddle
.
fluid
.
framework
.
_test_eager_guard
():
self
.
func_support_pad3
()
self
.
func_support_pad3
()
def
func_support_pad4
(
self
):
def
test_support_pad4
(
self
):
"""
test the type of 'pad' is paddle.Tensor.
"""
...
...
@@ -133,11 +112,6 @@ class TestZeroPad2dAPI(unittest.TestCase):
ret_res
=
zeropad2d
(
x_tensor
,
pad_tensor
).
numpy
()
np
.
testing
.
assert_allclose
(
expect_res
,
ret_res
,
rtol
=
1e-05
)
def
test_support_pad4
(
self
):
with
paddle
.
fluid
.
framework
.
_test_eager_guard
():
self
.
func_support_pad4
()
self
.
func_support_pad4
()
class
TestZeroPad2DLayer
(
unittest
.
TestCase
):
"""
...
...
@@ -159,18 +133,13 @@ class TestZeroPad2DLayer(unittest.TestCase):
],
)
def
func
_layer
(
self
):
def
test
_layer
(
self
):
np
.
testing
.
assert_allclose
(
zeropad2d
(
to_tensor
(
self
.
x
),
self
.
pad
).
numpy
(),
self
.
padLayer
(
to_tensor
(
self
.
x
)),
rtol
=
1e-05
,
)
def
test_layer
(
self
):
with
paddle
.
fluid
.
framework
.
_test_eager_guard
():
self
.
func_layer
()
self
.
func_layer
()
if
__name__
==
'__main__'
:
unittest
.
main
()
python/paddle/fluid/tests/unittests/test_zeros_like_op.py
浏览文件 @
f2c59b88
...
...
@@ -20,7 +20,7 @@ import paddle
import
paddle.fluid
as
fluid
from
paddle
import
_C_ops
,
zeros_like
from
paddle.fluid
import
Program
,
core
,
program_guard
from
paddle.fluid.framework
import
_test_eager_guard
,
convert_np_dtype_to_dtype_
from
paddle.fluid.framework
import
convert_np_dtype_to_dtype_
class
TestZerosLikeAPIError
(
unittest
.
TestCase
):
...
...
@@ -29,10 +29,6 @@ class TestZerosLikeAPIError(unittest.TestCase):
x
=
paddle
.
fluid
.
data
(
'x'
,
[
3
,
4
])
self
.
assertRaises
(
TypeError
,
zeros_like
,
x
,
'int8'
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_errors
()
class
TestZerosLikeAPI
(
unittest
.
TestCase
):
def
test_api
(
self
):
...
...
@@ -63,10 +59,6 @@ class TestZerosLikeAPI(unittest.TestCase):
self
.
assertEqual
(
outs
[
i
].
dtype
,
dtype
)
self
.
assertEqual
((
outs
[
i
]
==
np
.
zeros
(
shape
,
dtype
)).
all
(),
True
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_api
()
class
TestZerosLikeImpeartive
(
unittest
.
TestCase
):
def
test_out
(
self
):
...
...
@@ -89,10 +81,6 @@ class TestZerosLikeImpeartive(unittest.TestCase):
self
.
assertEqual
((
out
.
numpy
()
==
np
.
zeros
(
shape
,
dtype
)).
all
(),
True
)
paddle
.
enable_static
()
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_out
()
class
TestZerosAPI
(
unittest
.
TestCase
):
def
test_api
(
self
):
...
...
python/paddle/fluid/tests/unittests/test_zeros_op.py
浏览文件 @
f2c59b88
...
...
@@ -19,7 +19,6 @@ import numpy as np
import
paddle
import
paddle.fluid
as
fluid
from
paddle.fluid
import
Program
,
program_guard
from
paddle.fluid.framework
import
_test_eager_guard
class
TestZerosOpError
(
unittest
.
TestCase
):
...
...
@@ -29,10 +28,6 @@ class TestZerosOpError(unittest.TestCase):
dtype
=
'int8'
self
.
assertRaises
(
TypeError
,
fluid
.
layers
.
zeros
,
shape
,
dtype
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_errors
()
class
ApiZerosTest
(
unittest
.
TestCase
):
def
test_out
(
self
):
...
...
@@ -74,11 +69,6 @@ class ApiZerosTest(unittest.TestCase):
expected_result
=
np
.
zeros
(
10
,
dtype
=
'int64'
)
self
.
assertEqual
((
result
==
expected_result
).
all
(),
True
)
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_out
()
self
.
test_fluid_out
()
class
ApiZerosError
(
unittest
.
TestCase
):
def
test_errors
(
self
):
...
...
@@ -103,11 +93,6 @@ class ApiZerosError(unittest.TestCase):
error_msg
=
str
(
e
)
assert
error_msg
.
find
(
"expected to be no less than 0"
)
>
0
def
test_eager
(
self
):
with
_test_eager_guard
():
self
.
test_errors
()
self
.
test_shape_errors
()
if
__name__
==
'__main__'
:
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录