Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindarmour
提交
ffa97136
M
mindarmour
项目概览
MindSpore
/
mindarmour
通知
5
Star
3
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看板
提交
ffa97136
编写于
5月 28, 2020
作者:
Z
ZhidanLiu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update annotation of mechanism
上级
ed367920
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
4 addition
and
4 deletion
+4
-4
mindarmour/diff_privacy/mechanisms/mechanisms.py
mindarmour/diff_privacy/mechanisms/mechanisms.py
+4
-4
未找到文件。
mindarmour/diff_privacy/mechanisms/mechanisms.py
浏览文件 @
ffa97136
...
@@ -106,7 +106,7 @@ class GaussianRandom(Mechanisms):
...
@@ -106,7 +106,7 @@ class GaussianRandom(Mechanisms):
shape(tuple): The shape of gradients.
shape(tuple): The shape of gradients.
Returns:
Returns:
numpy.ndarray
, generated noise.
Tensor
, generated noise.
"""
"""
shape
=
check_param_type
(
'shape'
,
shape
,
tuple
)
shape
=
check_param_type
(
'shape'
,
shape
,
tuple
)
noise
=
np
.
random
.
normal
(
self
.
_mean
,
self
.
_stddev
,
shape
)
noise
=
np
.
random
.
normal
(
self
.
_mean
,
self
.
_stddev
,
shape
)
...
@@ -136,7 +136,7 @@ class AdaGaussianRandom(Mechanisms):
...
@@ -136,7 +136,7 @@ class AdaGaussianRandom(Mechanisms):
>>> norm_bound = 1.0
>>> norm_bound = 1.0
>>> initial_noise_multiplier = 0.1
>>> initial_noise_multiplier = 0.1
>>> alpha = 0.5
>>> alpha = 0.5
>>> decay_policy = "
Step
"
>>> decay_policy = "
Time
"
>>> net = AdaGaussianRandom(norm_bound, initial_noise_multiplier,
>>> net = AdaGaussianRandom(norm_bound, initial_noise_multiplier,
>>> alpha, decay_policy)
>>> alpha, decay_policy)
>>> res = net(shape)
>>> res = net(shape)
...
@@ -144,7 +144,7 @@ class AdaGaussianRandom(Mechanisms):
...
@@ -144,7 +144,7 @@ class AdaGaussianRandom(Mechanisms):
"""
"""
def
__init__
(
self
,
norm_bound
=
1.5
,
initial_noise_multiplier
=
5.0
,
def
__init__
(
self
,
norm_bound
=
1.5
,
initial_noise_multiplier
=
5.0
,
alpha
=
6e-4
,
decay_policy
=
'
Step
'
):
alpha
=
6e-4
,
decay_policy
=
'
Time
'
):
super
(
AdaGaussianRandom
,
self
).
__init__
()
super
(
AdaGaussianRandom
,
self
).
__init__
()
initial_noise_multiplier
=
check_value_positive
(
'initial_noise_multiplier'
,
initial_noise_multiplier
=
check_value_positive
(
'initial_noise_multiplier'
,
initial_noise_multiplier
)
initial_noise_multiplier
)
...
@@ -194,7 +194,7 @@ class AdaGaussianRandom(Mechanisms):
...
@@ -194,7 +194,7 @@ class AdaGaussianRandom(Mechanisms):
shape(tuple): The shape of gradients.
shape(tuple): The shape of gradients.
Returns:
Returns:
numpy.ndarray
, generated noise.
Tensor
, generated noise.
"""
"""
shape
=
check_param_type
(
'shape'
,
shape
,
tuple
)
shape
=
check_param_type
(
'shape'
,
shape
,
tuple
)
noise
=
np
.
random
.
normal
(
self
.
_mean
,
self
.
_stddev
.
asnumpy
(),
noise
=
np
.
random
.
normal
(
self
.
_mean
,
self
.
_stddev
.
asnumpy
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录