Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindarmour
提交
7d478445
M
mindarmour
项目概览
MindSpore
/
mindarmour
通知
4
Star
2
Fork
3
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindarmour
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
7d478445
编写于
7月 17, 2020
作者:
Z
ZhidanLiu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add a construct of clip_mech and noise_mech, when noise_mech is adaptive clip_mech must be none
上级
01d40e16
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
8 addition
and
6 deletion
+8
-6
mindarmour/diff_privacy/train/model.py
mindarmour/diff_privacy/train/model.py
+7
-1
tests/ut/python/diff_privacy/test_model_train.py
tests/ut/python/diff_privacy/test_model_train.py
+1
-5
未找到文件。
mindarmour/diff_privacy/train/model.py
浏览文件 @
7d478445
...
@@ -143,7 +143,13 @@ class DPModel(Model):
...
@@ -143,7 +143,13 @@ class DPModel(Model):
LOGGER
.
error
(
TAG
,
msg
)
LOGGER
.
error
(
TAG
,
msg
)
raise
ValueError
(
msg
)
raise
ValueError
(
msg
)
self
.
_noise_mech
=
noise_mech
self
.
_noise_mech
=
noise_mech
if
clip_mech
is
not
None
:
if
noise_mech
is
not
None
:
if
'Ada'
in
noise_mech
.
__class__
.
__name__
and
clip_mech
is
not
None
:
msg
=
'When noise_mech is Adaptive, clip_mech must be None.'
LOGGER
.
error
(
TAG
,
msg
)
raise
ValueError
(
msg
)
if
clip_mech
is
None
or
isinstance
(
clip_mech
,
Cell
):
self
.
_clip_mech
=
clip_mech
self
.
_clip_mech
=
clip_mech
super
(
DPModel
,
self
).
__init__
(
**
kwargs
)
super
(
DPModel
,
self
).
__init__
(
**
kwargs
)
...
...
tests/ut/python/diff_privacy/test_model_train.py
浏览文件 @
7d478445
...
@@ -134,11 +134,7 @@ def test_dp_model_with_graph_mode_ada_gaussian():
...
@@ -134,11 +134,7 @@ def test_dp_model_with_graph_mode_ada_gaussian():
noise_mech
=
NoiseMechanismsFactory
().
create
(
'AdaGaussian'
,
noise_mech
=
NoiseMechanismsFactory
().
create
(
'AdaGaussian'
,
norm_bound
=
norm_clip
,
norm_bound
=
norm_clip
,
initial_noise_multiplier
=
initial_noise_multiplier
)
initial_noise_multiplier
=
initial_noise_multiplier
)
clip_mech
=
ClipMechanismsFactory
().
create
(
'Gaussian'
,
clip_mech
=
None
decay_policy
=
'Linear'
,
learning_rate
=
0.01
,
target_unclipped_quantile
=
0.9
,
fraction_stddev
=
0.01
)
net_opt
=
nn
.
Momentum
(
network
.
trainable_params
(),
learning_rate
=
0.1
,
net_opt
=
nn
.
Momentum
(
network
.
trainable_params
(),
learning_rate
=
0.1
,
momentum
=
0.9
)
momentum
=
0.9
)
model
=
DPModel
(
micro_batches
=
2
,
model
=
DPModel
(
micro_batches
=
2
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录