Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
e26411ce
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看板
未验证
提交
e26411ce
编写于
8月 28, 2019
作者:
C
chengduo
提交者:
GitHub
8月 28, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Open test_parallel_dygraph_se_resnext (#19342)
* enabel test_parallel_dygraph_se_resnext test=develop
上级
caf59d0f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
16 addition
and
11 deletion
+16
-11
python/paddle/fluid/tests/unittests/parallel_dygraph_se_resnext.py
...ddle/fluid/tests/unittests/parallel_dygraph_se_resnext.py
+10
-3
python/paddle/fluid/tests/unittests/test_parallel_dygraph_se_resnext.py
...fluid/tests/unittests/test_parallel_dygraph_se_resnext.py
+6
-8
未找到文件。
python/paddle/fluid/tests/unittests/parallel_dygraph_se_resnext.py
浏览文件 @
e26411ce
...
...
@@ -57,10 +57,15 @@ class ConvBNLayer(fluid.dygraph.Layer):
self
.
_batch_norm
=
BatchNorm
(
self
.
full_name
(),
num_filters
,
act
=
act
,
momentum
=
0.1
)
self
.
_layer_norm
=
fluid
.
dygraph
.
nn
.
LayerNorm
(
self
.
full_name
(),
begin_norm_axis
=
1
)
def
forward
(
self
,
inputs
):
y
=
self
.
_conv
(
inputs
)
y
=
self
.
_batch_norm
(
y
)
# FIXME(zcd): when compare the result of multi-card and single-card,
# we should replace batch_norm with layer_norm.
y
=
self
.
_layer_norm
(
y
)
# y = self._batch_norm(y)
return
y
...
...
@@ -278,7 +283,9 @@ class SeResNeXt(fluid.dygraph.Layer):
for
bottleneck_block
in
self
.
bottleneck_block_list
:
y
=
bottleneck_block
(
y
)
y
=
self
.
pool2d_avg
(
y
)
y
=
fluid
.
layers
.
dropout
(
y
,
dropout_prob
=
0.2
,
seed
=
1
)
# FIXME(zcd): the dropout should be removed when compare the
# result of multi-card and single-card.
# y = fluid.layers.dropout(y, dropout_prob=0.2, seed=1)
cost
=
self
.
fc
(
y
)
loss
=
fluid
.
layers
.
cross_entropy
(
cost
,
label
)
avg_loss
=
fluid
.
layers
.
mean
(
loss
)
...
...
@@ -290,7 +297,7 @@ class TestSeResNeXt(TestParallelDyGraphRunnerBase):
model
=
SeResNeXt
(
"se-resnext"
)
train_reader
=
paddle
.
batch
(
paddle
.
dataset
.
flowers
.
test
(
use_xmap
=
False
),
batch_size
=
2
,
batch_size
=
4
,
drop_last
=
True
)
opt
=
fluid
.
optimizer
.
SGD
(
learning_rate
=
1e-3
)
...
...
python/paddle/fluid/tests/unittests/test_parallel_dygraph_se_resnext.py
浏览文件 @
e26411ce
...
...
@@ -13,10 +13,11 @@
# limitations under the License.
from
__future__
import
print_function
#
import unittest
import
unittest
from
test_dist_base
import
TestDistBase
import
paddle.fluid
as
fluid
'''
class
TestParallelDygraphSeResNeXt
(
TestDistBase
):
def
_setup_config
(
self
):
self
.
_sync_mode
=
False
...
...
@@ -24,12 +25,9 @@ class TestParallelDygraphSeResNeXt(TestDistBase):
self
.
_dygraph
=
True
def
test_se_resnext
(
self
):
# TODO(Yancey1989): BN and Dropout is related with batchsize, so the delta is the 1,
# try to remove the BN and Dropout in the network and using delta = 1e-5
if
fluid
.
core
.
is_compiled_with_cuda
():
self.check_with_place("parallel_dygraph_se_resnext.py", delta=1)
'''
self
.
check_with_place
(
"parallel_dygraph_se_resnext.py"
,
delta
=
0.0
1
)
if
__name__
==
"__main__"
:
pass
#unittest.main()
unittest
.
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录