Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
Paddle
提交
6cf74c25
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看板
未验证
提交
6cf74c25
编写于
9月 07, 2020
作者:
Z
zhang wenhui
提交者:
GitHub
9月 07, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix batchnorm ,test=develop (#27036)
上级
3fb9ee6f
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
6 addition
and
7 deletion
+6
-7
python/paddle/nn/functional/norm.py
python/paddle/nn/functional/norm.py
+3
-4
python/paddle/nn/layer/norm.py
python/paddle/nn/layer/norm.py
+3
-3
未找到文件。
python/paddle/nn/functional/norm.py
浏览文件 @
6cf74c25
...
@@ -176,13 +176,12 @@ def batch_norm(x,
...
@@ -176,13 +176,12 @@ def batch_norm(x,
mean_out
=
running_mean
mean_out
=
running_mean
variance_out
=
running_var
variance_out
=
running_var
true_data_format
=
[
'NC'
,
'NCL'
,
'NCHW'
,
'NC
WH'
,
'NC
DHW'
]
true_data_format
=
[
'NC'
,
'NCL'
,
'NCHW'
,
'NCDHW'
]
if
data_format
not
in
true_data_format
:
if
data_format
not
in
true_data_format
:
raise
ValueError
(
raise
ValueError
(
"data_format must be one of 'NC', 'NCL', 'NCHW', 'NC
WH', 'NC
DHW', but receive {}"
.
"data_format must be one of 'NC', 'NCL', 'NCHW', 'NCDHW', but receive {}"
.
format
(
data_format
))
format
(
data_format
))
if
data_format
!=
'NCWH'
:
data_format
=
'NCHW'
data_format
=
'NCHW'
if
in_dygraph_mode
():
if
in_dygraph_mode
():
...
...
python/paddle/nn/layer/norm.py
浏览文件 @
6cf74c25
...
@@ -811,7 +811,7 @@ class BatchNorm2d(_BatchNormBase):
...
@@ -811,7 +811,7 @@ class BatchNorm2d(_BatchNormBase):
If it is set to None or one attribute of ParamAttr, batch_norm
If it is set to None or one attribute of ParamAttr, batch_norm
will create ParamAttr as bias_attr. If it is set to Fasle, the weight is not learnable.
will create ParamAttr as bias_attr. If it is set to Fasle, the weight is not learnable.
If the Initializer of the bias_attr is not set, the bias is initialized zero. Default: None.
If the Initializer of the bias_attr is not set, the bias is initialized zero. Default: None.
data_format(str, optional): Specify the input data format, the data format can be "NCHW"
or "NHWC"
. Default: NCHW.
data_format(str, optional): Specify the input data format, the data format can be "NCHW". Default: NCHW.
track_running_stats(bool, optional): Whether to use global mean and variance. In train period,
track_running_stats(bool, optional): Whether to use global mean and variance. In train period,
True will track global mean and variance used for inference. When inference, track_running_stats must be
True will track global mean and variance used for inference. When inference, track_running_stats must be
True. Default: True.
True. Default: True.
...
@@ -844,10 +844,10 @@ class BatchNorm2d(_BatchNormBase):
...
@@ -844,10 +844,10 @@ class BatchNorm2d(_BatchNormBase):
"""
"""
def
_check_data_format
(
self
,
input
):
def
_check_data_format
(
self
,
input
):
if
input
==
'NCHW'
or
input
==
'NCWH'
:
if
input
==
'NCHW'
:
self
.
_data_format
=
input
self
.
_data_format
=
input
else
:
else
:
raise
ValueError
(
'expected NCHW
or NCWH
for data_format input'
)
raise
ValueError
(
'expected NCHW for data_format input'
)
def
_check_input_dim
(
self
,
input
):
def
_check_input_dim
(
self
,
input
):
if
len
(
input
.
shape
)
!=
4
:
if
len
(
input
.
shape
)
!=
4
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录