Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
MindSpore
mindarmour
提交
be377fb1
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看板
提交
be377fb1
编写于
5月 28, 2020
作者:
Z
zhenghuanhuan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1IKCU
fix [MA][diff_privacy][Doc] the tutorials of diff_privacy has problem
上级
30f6c260
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
4 addition
and
5 deletion
+4
-5
example/mnist_demo/lenet5_dp_model_train.py
example/mnist_demo/lenet5_dp_model_train.py
+3
-3
example/mnist_demo/mnist_train.py
example/mnist_demo/mnist_train.py
+1
-2
未找到文件。
example/mnist_demo/lenet5_dp_model_train.py
浏览文件 @
be377fb1
...
@@ -92,15 +92,15 @@ if __name__ == "__main__":
...
@@ -92,15 +92,15 @@ if __name__ == "__main__":
parser
.
add_argument
(
'--data_path'
,
type
=
str
,
default
=
"./MNIST_unzip"
,
parser
.
add_argument
(
'--data_path'
,
type
=
str
,
default
=
"./MNIST_unzip"
,
help
=
'path where the dataset is saved'
)
help
=
'path where the dataset is saved'
)
parser
.
add_argument
(
'--dataset_sink_mode'
,
type
=
bool
,
default
=
False
,
help
=
'dataset_sink_mode is False or True'
)
parser
.
add_argument
(
'--dataset_sink_mode'
,
type
=
bool
,
default
=
False
,
help
=
'dataset_sink_mode is False or True'
)
parser
.
add_argument
(
'--micro_batches'
,
type
=
floa
t
,
default
=
None
,
parser
.
add_argument
(
'--micro_batches'
,
type
=
in
t
,
default
=
None
,
help
=
'optional, if use differential privacy, need to set micro_batches'
)
help
=
'optional, if use differential privacy, need to set micro_batches'
)
parser
.
add_argument
(
'--l2_norm_bound'
,
type
=
float
,
default
=
1
,
parser
.
add_argument
(
'--l2_norm_bound'
,
type
=
float
,
default
=
0.
1
,
help
=
'optional, if use differential privacy, need to set l2_norm_bound'
)
help
=
'optional, if use differential privacy, need to set l2_norm_bound'
)
parser
.
add_argument
(
'--initial_noise_multiplier'
,
type
=
float
,
default
=
0.001
,
parser
.
add_argument
(
'--initial_noise_multiplier'
,
type
=
float
,
default
=
0.001
,
help
=
'optional, if use differential privacy, need to set initial_noise_multiplier'
)
help
=
'optional, if use differential privacy, need to set initial_noise_multiplier'
)
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
context
.
set_context
(
mode
=
context
.
PYNATIVE_MODE
,
device_target
=
args
.
device_target
,
enable_mem_reuse
=
False
)
context
.
set_context
(
mode
=
context
.
PYNATIVE_MODE
,
device_target
=
args
.
device_target
)
network
=
LeNet5
()
network
=
LeNet5
()
net_loss
=
nn
.
SoftmaxCrossEntropyWithLogits
(
is_grad
=
False
,
sparse
=
True
,
reduction
=
"mean"
)
net_loss
=
nn
.
SoftmaxCrossEntropyWithLogits
(
is_grad
=
False
,
sparse
=
True
,
reduction
=
"mean"
)
...
...
example/mnist_demo/mnist_train.py
浏览文件 @
be377fb1
...
@@ -61,6 +61,5 @@ def mnist_train(epoch_size, batch_size, lr, momentum):
...
@@ -61,6 +61,5 @@ def mnist_train(epoch_size, batch_size, lr, momentum):
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
context
.
set_context
(
mode
=
context
.
GRAPH_MODE
,
device_target
=
"CPU"
,
context
.
set_context
(
mode
=
context
.
GRAPH_MODE
,
device_target
=
"CPU"
)
enable_mem_reuse
=
False
)
mnist_train
(
10
,
32
,
0.01
,
0.9
)
mnist_train
(
10
,
32
,
0.01
,
0.9
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录