Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
兽拳
Paddle
提交
cb5e0d20
P
Paddle
项目概览
兽拳
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cb5e0d20
编写于
1月 16, 2020
作者:
Z
zhupengyang
提交者:
hong19860320
1月 16, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
skip cases with small shape (#22318)
上级
8cb04664
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
28 addition
and
21 deletion
+28
-21
python/paddle/fluid/tests/unittests/op_test.py
python/paddle/fluid/tests/unittests/op_test.py
+6
-6
python/paddle/fluid/tests/unittests/test_prelu_op.py
python/paddle/fluid/tests/unittests/test_prelu_op.py
+22
-13
python/paddle/fluid/tests/unittests/white_list/check_shape_white_list.py
...luid/tests/unittests/white_list/check_shape_white_list.py
+0
-2
未找到文件。
python/paddle/fluid/tests/unittests/op_test.py
浏览文件 @
cb5e0d20
python/paddle/fluid/tests/unittests/test_prelu_op.py
浏览文件 @
cb5e0d20
...
@@ -17,15 +17,16 @@ from __future__ import print_function
...
@@ -17,15 +17,16 @@ from __future__ import print_function
import
unittest
import
unittest
import
numpy
as
np
import
numpy
as
np
import
six
import
six
from
op_test
import
OpTest
from
op_test
import
OpTest
,
skip_check_grad_ci
class
PReluTest
(
OpTest
):
class
PReluTest
(
OpTest
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
init_input_shape
()
self
.
init_attr
()
self
.
op_type
=
"prelu"
self
.
op_type
=
"prelu"
self
.
initTestCase
()
x_np
=
np
.
random
.
normal
(
size
=
(
3
,
5
,
5
,
10
)).
astype
(
"float32"
)
x_np
=
np
.
random
.
uniform
(
-
1
,
1
,
self
.
x_shape
).
astype
(
"float32"
)
# Since zero point in prelu is not differentiable, avoid randomize
# Since zero point in prelu is not differentiable, avoid randomize
# zero.
# zero.
x_np
[
np
.
abs
(
x_np
)
<
0.005
]
=
0.02
x_np
[
np
.
abs
(
x_np
)
<
0.005
]
=
0.02
...
@@ -37,7 +38,7 @@ class PReluTest(OpTest):
...
@@ -37,7 +38,7 @@ class PReluTest(OpTest):
alpha_np
=
np
.
random
.
rand
(
1
,
x_np
.
shape
[
1
],
1
,
1
).
astype
(
"float32"
)
alpha_np
=
np
.
random
.
rand
(
1
,
x_np
.
shape
[
1
],
1
,
1
).
astype
(
"float32"
)
self
.
inputs
=
{
'X'
:
x_np
,
'Alpha'
:
alpha_np
}
self
.
inputs
=
{
'X'
:
x_np
,
'Alpha'
:
alpha_np
}
else
:
else
:
alpha_np
=
np
.
random
.
rand
(
1
,
x_np
.
shape
[
1
],
x_np
.
shape
[
2
],
\
alpha_np
=
np
.
random
.
rand
(
1
,
x_np
.
shape
[
1
],
x_np
.
shape
[
2
],
x_np
.
shape
[
3
]).
astype
(
"float32"
)
x_np
.
shape
[
3
]).
astype
(
"float32"
)
self
.
inputs
=
{
'X'
:
x_np
,
'Alpha'
:
alpha_np
}
self
.
inputs
=
{
'X'
:
x_np
,
'Alpha'
:
alpha_np
}
...
@@ -47,7 +48,10 @@ class PReluTest(OpTest):
...
@@ -47,7 +48,10 @@ class PReluTest(OpTest):
assert
out_np
is
not
self
.
inputs
[
'X'
]
assert
out_np
is
not
self
.
inputs
[
'X'
]
self
.
outputs
=
{
'Out'
:
out_np
}
self
.
outputs
=
{
'Out'
:
out_np
}
def
initTestCase
(
self
):
def
init_input_shape
(
self
):
self
.
x_shape
=
(
2
,
100
,
3
,
4
)
def
init_attr
(
self
):
self
.
attrs
=
{
'mode'
:
"channel"
}
self
.
attrs
=
{
'mode'
:
"channel"
}
def
test_check_output
(
self
):
def
test_check_output
(
self
):
...
@@ -66,16 +70,21 @@ class PReluTest(OpTest):
...
@@ -66,16 +70,21 @@ class PReluTest(OpTest):
# TODO(minqiyang): Resume these test cases after fixing Python3 CI job issues
# TODO(minqiyang): Resume these test cases after fixing Python3 CI job issues
if
six
.
PY2
:
if
six
.
PY2
:
class
TestCase1
(
PReluTest
):
@
skip_check_grad_ci
(
def
initTestCase
(
self
):
reason
=
"[skip shape check] Input(Alpha) must be 1-D and only has one data in 'all' mode"
)
class
TestModeAll
(
PReluTest
):
def
init_input_shape
(
self
):
self
.
x_shape
=
(
2
,
3
,
4
,
5
)
def
init_attr
(
self
):
self
.
attrs
=
{
'mode'
:
"all"
}
self
.
attrs
=
{
'mode'
:
"all"
}
class
Test
Case2
(
PReluTest
):
class
Test
ModeElt
(
PReluTest
):
def
init
TestCas
e
(
self
):
def
init
_input_shap
e
(
self
):
self
.
attrs
=
{
'mode'
:
"channel"
}
self
.
x_shape
=
(
3
,
2
,
5
,
10
)
class
TestCase3
(
PReluTest
):
def
init_attr
(
self
):
def
initTestCase
(
self
):
self
.
attrs
=
{
'mode'
:
"element"
}
self
.
attrs
=
{
'mode'
:
"element"
}
...
...
python/paddle/fluid/tests/unittests/white_list/check_shape_white_list.py
浏览文件 @
cb5e0d20
...
@@ -24,8 +24,6 @@ NOT_CHECK_OP_LIST = [
...
@@ -24,8 +24,6 @@ NOT_CHECK_OP_LIST = [
'elementwise_min'
,
'elementwise_min'
,
'elementwise_pow'
,
'elementwise_pow'
,
'fused_elemwise_activation'
,
'fused_elemwise_activation'
,
# prelu op's input alpha must be 1-d and only has one data in 'all' mode
'prelu'
]
]
NEED_TO_FIX_OP_LIST
=
[
NEED_TO_FIX_OP_LIST
=
[
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录