Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
bb271b6d
P
Paddle
项目概览
BaiXuePrincess
/
Paddle
与 Fork 源项目一致
Fork自
PaddlePaddle / Paddle
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
bb271b6d
编写于
9月 26, 2019
作者:
Q
qingqing01
提交者:
GitHub
9月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove unit testing for large shape in test_affine_channel_op (#19993)
上级
f50e701b
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
34 addition
and
32 deletion
+34
-32
python/paddle/fluid/tests/unittests/test_affine_channel_op.py
...on/paddle/fluid/tests/unittests/test_affine_channel_op.py
+34
-32
未找到文件。
python/paddle/fluid/tests/unittests/test_affine_channel_op.py
浏览文件 @
bb271b6d
...
@@ -11,6 +11,9 @@
...
@@ -11,6 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.
"""
Unit testing for affine_channel_op
"""
from
__future__
import
print_function
from
__future__
import
print_function
...
@@ -36,9 +39,9 @@ class TestAffineChannelOp(OpTest):
...
@@ -36,9 +39,9 @@ class TestAffineChannelOp(OpTest):
self
.
op_type
=
"affine_channel"
self
.
op_type
=
"affine_channel"
self
.
init_test_case
()
self
.
init_test_case
()
x
=
np
.
random
.
random
(
self
.
shape
).
astype
(
"float
32
"
)
x
=
np
.
random
.
random
(
self
.
shape
).
astype
(
"float
64
"
)
scale
=
np
.
random
.
random
(
self
.
C
).
astype
(
"float
32
"
)
scale
=
np
.
random
.
random
(
self
.
C
).
astype
(
"float
64
"
)
bias
=
np
.
random
.
random
(
self
.
C
).
astype
(
"float
32
"
)
bias
=
np
.
random
.
random
(
self
.
C
).
astype
(
"float
64
"
)
y
=
affine_channel
(
x
,
scale
,
bias
,
self
.
layout
)
y
=
affine_channel
(
x
,
scale
,
bias
,
self
.
layout
)
...
@@ -59,15 +62,15 @@ class TestAffineChannelOp(OpTest):
...
@@ -59,15 +62,15 @@ class TestAffineChannelOp(OpTest):
self
.
check_grad
([
'X'
],
'Out'
,
no_grad_set
=
set
([
'Scale'
,
'Bias'
]))
self
.
check_grad
([
'X'
],
'Out'
,
no_grad_set
=
set
([
'Scale'
,
'Bias'
]))
def
init_test_case
(
self
):
def
init_test_case
(
self
):
self
.
shape
=
[
2
,
32
,
14
,
14
]
self
.
shape
=
[
2
,
8
,
12
,
12
]
self
.
C
=
32
self
.
C
=
8
self
.
layout
=
'NCHW'
self
.
layout
=
'NCHW'
class
TestAffineChannelNHWC
(
TestAffineChannelOp
):
class
TestAffineChannelNHWC
(
TestAffineChannelOp
):
def
init_test_case
(
self
):
def
init_test_case
(
self
):
self
.
shape
=
[
2
,
1
4
,
14
,
32
]
self
.
shape
=
[
2
,
1
2
,
12
,
16
]
self
.
C
=
32
self
.
C
=
16
self
.
layout
=
'NHWC'
self
.
layout
=
'NHWC'
def
test_check_grad_stopgrad_dx
(
self
):
def
test_check_grad_stopgrad_dx
(
self
):
...
@@ -79,8 +82,8 @@ class TestAffineChannelNHWC(TestAffineChannelOp):
...
@@ -79,8 +82,8 @@ class TestAffineChannelNHWC(TestAffineChannelOp):
class
TestAffineChannel2D
(
TestAffineChannelOp
):
class
TestAffineChannel2D
(
TestAffineChannelOp
):
def
init_test_case
(
self
):
def
init_test_case
(
self
):
self
.
shape
=
[
16
,
64
]
self
.
shape
=
[
8
,
32
]
self
.
C
=
64
self
.
C
=
32
self
.
layout
=
'NCHW'
self
.
layout
=
'NCHW'
def
test_check_grad_stopgrad_dx
(
self
):
def
test_check_grad_stopgrad_dx
(
self
):
...
@@ -90,29 +93,28 @@ class TestAffineChannel2D(TestAffineChannelOp):
...
@@ -90,29 +93,28 @@ class TestAffineChannel2D(TestAffineChannelOp):
return
return
class
TestAffineChannelNCHWLargeShape
(
TestAffineChannelOp
):
# TODO(qingqing): disable unit testing for large shape
def
init_test_case
(
self
):
#class TestAffineChannelNCHWLargeShape(TestAffineChannelOp):
self
.
shape
=
[
4
,
128
,
112
,
112
]
# def init_test_case(self):
self
.
C
=
128
# self.shape = [4, 128, 112, 112]
self
.
layout
=
'NCHW'
# self.C = 128
# self.layout = 'NCHW'
# since the gradient check is very slow in large shape, so skip check_grad
#
def
test_check_grad
(
self
):
# # since the gradient check is very slow in large shape, so skip check_grad
pass
# def test_check_grad(self):
# pass
def
test_check_grad_stopgrad_dx
(
self
):
#
pass
# def test_check_grad_stopgrad_dx(self):
# pass
def
test_check_grad_stopgrad_dscale_dbias
(
self
):
#
pass
# def test_check_grad_stopgrad_dscale_dbias(self):
# pass
class
TestAffineChannelNHWCLargeShape
(
TestAffineChannelNCHWLargeShape
):
#class TestAffineChannelNHWCLargeShape(TestAffineChannelNCHWLargeShape):
def
init_test_case
(
self
):
# def init_test_case(self):
self
.
shape
=
[
64
,
32
,
32
,
128
]
# self.shape = [64, 32, 32, 128]
self
.
C
=
128
# self.C = 128
self
.
layout
=
'NHWC'
# self.layout = 'NHWC'
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录