Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
9944abe9
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
9944abe9
编写于
6月 11, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
6月 11, 2020
浏览文件
操作
浏览文件
下载
差异文件
!1963 bug fix in fake quant training in r0.3
Merge pull request !1963 from chenzhongming/r0.3
上级
eaaacfea
bb58ea35
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
3 addition
and
6 deletion
+3
-6
mindspore/nn/layer/quant.py
mindspore/nn/layer/quant.py
+2
-5
mindspore/train/quant/quant.py
mindspore/train/quant/quant.py
+1
-1
未找到文件。
mindspore/nn/layer/quant.py
浏览文件 @
9944abe9
...
...
@@ -118,7 +118,6 @@ class FakeQuantWithMinMax(Cell):
quant_delay (int): Quantization delay parameters according by global step. Default: 0.
symmetric (bool): Quantization algorithm use symmetric or not. Default: False.
narrow_range (bool): Quantization algorithm use narrow range or not. Default: False.
training (bool): Quantization algorithm training or not. Default: True.
Inputs:
- **x** (Tensor) - The input of FakeQuantWithMinMax.
...
...
@@ -143,8 +142,7 @@ class FakeQuantWithMinMax(Cell):
out_channels
=
1
,
quant_delay
=
0
,
symmetric
=
False
,
narrow_range
=
False
,
training
=
True
):
narrow_range
=
False
):
"""init FakeQuantWithMinMax layer"""
super
(
FakeQuantWithMinMax
,
self
).
__init__
()
self
.
min_init
=
min_init
...
...
@@ -158,7 +156,6 @@ class FakeQuantWithMinMax(Cell):
self
.
quant_delay
=
quant_delay
self
.
symmetric
=
symmetric
self
.
narrow_range
=
narrow_range
self
.
training
=
training
self
.
is_ascend
=
context
.
get_context
(
'device_target'
)
==
"Ascend"
# init tensor min and max for fake quant op
...
...
@@ -208,7 +205,7 @@ class FakeQuantWithMinMax(Cell):
return
s
def
construct
(
self
,
x
):
if
self
.
ema
and
self
.
is_ascend
:
if
self
.
is_ascend
and
self
.
training
:
min_up
,
max_up
=
self
.
ema_update
(
x
,
self
.
minq
,
self
.
maxq
)
out
=
self
.
fake_quant
(
x
,
min_up
,
max_up
)
P
.
Assign
()(
self
.
minq
,
min_up
)
...
...
mindspore/train/quant/quant.py
浏览文件 @
9944abe9
...
...
@@ -247,7 +247,7 @@ def convert_quant_network(network,
network (Cell): Obtain a pipeline through network for saving graph summary.
quant_delay (int): Number of steps after which weights and activations are quantized during eval. Default: 0.
bn_fold (bool): Flag to used bn fold ops for simulation inference operation. Default: False.
freeze_bn (
bool
): Number of steps after which BN parameters used total mean and variance. Default: 0.
freeze_bn (
int
): Number of steps after which BN parameters used total mean and variance. Default: 0.
weight_bits (int): Number of bits to use for quantizing weights. Default: 8.
act_bits (int): Number of bits to use for quantizing activations. Default: 8.
per_channel (bool): Quantization granularity based on layer or on channel. Default: False.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录