Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MegEngine 天元
MegEngine
提交
5e548218
MegEngine
项目概览
MegEngine 天元
/
MegEngine
1 年多 前同步成功
通知
403
Star
4705
Fork
582
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
MegEngine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
5e548218
编写于
5月 24, 2021
作者:
M
Megvii Engine Team
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
docs(syncbn): complete syncbn document
GitOrigin-RevId: 9b8d546f0b1431d502ee6f69fd3ccbd072a73e71
上级
3591ef1f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
33 addition
and
0 deletion
+33
-0
imperative/python/megengine/functional/nn.py
imperative/python/megengine/functional/nn.py
+4
-0
imperative/python/megengine/module/batchnorm.py
imperative/python/megengine/module/batchnorm.py
+29
-0
未找到文件。
imperative/python/megengine/functional/nn.py
浏览文件 @
5e548218
...
...
@@ -1125,6 +1125,10 @@ def sync_batch_norm(
Default: 0.9
:param eps: a value added to the denominator for numerical stability.
Default: 1e-5
:param eps_mode: mode of calculation for eps, "max" or "additive".
Default: "additive"
:param group: communication group, caculate mean and variance between this group.
Default: :obj:`~megengine.distributed.WORLD`
:return: output tensor.
"""
assert
eps_mode
.
lower
()
in
{
"max"
,
"additive"
},
"unknown eps_mode: {}"
.
format
(
...
...
imperative/python/megengine/module/batchnorm.py
浏览文件 @
5e548218
...
...
@@ -141,6 +141,35 @@ class _BatchNorm(Module):
class
SyncBatchNorm
(
_BatchNorm
):
r
"""
Applies Synchronized Batch Normalization for distributed training.
:type num_features: int
:param num_features: usually :math:`C` from an input of shape
:math:`(N, C, H, W)` or the highest ranked dimension of an input
less than 4D.
:type eps: float
:param eps: a value added to the denominator for numerical stability.
Default: 1e-5
:type momentum: float
:param momentum: the value used for the ``running_mean`` and ``running_var`` computation.
Default: 0.9
:type affine: bool
:param affine: a boolean value that when set to True, this module has
learnable affine parameters. Default: True
:type track_running_stats: bool
:param track_running_stats: when set to True, this module tracks the
running mean and variance. When set to False, this module does not
track such statistics and always uses batch statistics in both training
and eval modes. Default: True
:type freeze: bool
:param freeze: when set to True, this module does not update the
running mean and variance, and uses the running mean and variance instead of
the batch mean and batch variance to normalize the input. The parameter takes effect
only when the module is initilized with track_running_stats as True.
Default: False
:type group: :class:`~megengine.distributed.Group`
:param group: communication group, caculate mean and variance between this group.
Default: :obj:`~megengine.distributed.WORLD`
:return: output tensor.
"""
def
__init__
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录