Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleFL
提交
08ea0b2a
P
PaddleFL
项目概览
PaddlePaddle
/
PaddleFL
通知
35
Star
5
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
6
列表
看板
标记
里程碑
合并请求
4
Wiki
3
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleFL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
6
Issue
6
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
3
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
08ea0b2a
编写于
9月 11, 2020
作者:
H
He, Kai
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ut
上级
637e476b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
22 addition
and
21 deletion
+22
-21
python/paddle_fl/mpc/tests/unittests/op_test.py
python/paddle_fl/mpc/tests/unittests/op_test.py
+4
-4
python/paddle_fl/mpc/tests/unittests/test_op_base.py
python/paddle_fl/mpc/tests/unittests/test_op_base.py
+8
-8
python/paddle_fl/mpc/tests/unittests/test_op_conv.py
python/paddle_fl/mpc/tests/unittests/test_op_conv.py
+3
-3
python/paddle_fl/mpc/tests/unittests/test_op_metric.py
python/paddle_fl/mpc/tests/unittests/test_op_metric.py
+2
-1
python/paddle_fl/mpc/tests/unittests/test_op_pool.py
python/paddle_fl/mpc/tests/unittests/test_op_pool.py
+5
-5
未找到文件。
python/paddle_fl/mpc/tests/unittests/op_test.py
浏览文件 @
08ea0b2a
...
...
@@ -140,13 +140,13 @@ class OpTest(unittest.TestCase):
target
=
kwargs
[
'target'
]
part
y
s
=
[]
part
ie
s
=
[]
for
role
in
range
(
self
.
party_num
):
kwargs
.
update
({
'role'
:
role
})
part
y
s
.
append
(
Aby3Process
(
target
=
target
,
kwargs
=
kwargs
))
part
y
s
[
-
1
].
start
()
for
party
in
part
y
s
:
part
ie
s
.
append
(
Aby3Process
(
target
=
target
,
kwargs
=
kwargs
))
part
ie
s
[
-
1
].
start
()
for
party
in
part
ie
s
:
party
.
join
()
if
party
.
exception
:
return
party
.
exception
...
...
python/paddle_fl/mpc/tests/unittests/test_op_base.py
浏览文件 @
08ea0b2a
...
...
@@ -77,13 +77,13 @@ class TestOpBase(unittest.TestCase):
"""
target
=
kwargs
[
'target'
]
parties
=
[]
for
role
in
range
(
self
.
party_num
):
kwargs
.
update
({
'role'
:
role
})
party
=
Aby3Process
(
target
=
target
,
kwargs
=
kwargs
)
party
.
start
()
if
role
==
self
.
party_num
-
1
:
party
.
join
()
if
party
.
exception
:
return
party
.
exception
else
:
return
(
True
,)
parties
.
append
(
Aby3Process
(
target
=
target
,
kwargs
=
kwargs
))
parties
[
-
1
].
start
()
for
party
in
parties
:
party
.
join
()
if
party
.
exception
:
return
party
.
exception
return
(
True
,)
python/paddle_fl/mpc/tests/unittests/test_op_conv.py
浏览文件 @
08ea0b2a
...
...
@@ -19,10 +19,10 @@ import unittest
from
multiprocessing
import
Manager
import
numpy
as
np
import
test_op_base
from
op_test
import
OpTest
import
paddle_fl.mpc.data_utils.aby3
as
aby3
import
mpc_data_utils
as
mdu
import
paddle.fluid
as
fluid
import
paddle.fluid.core
as
core
...
...
@@ -190,7 +190,7 @@ class TestConv2dOp(OpTest):
'dilation'
:
self
.
dilations
}
share
=
lambda
x
:
np
.
array
([
x
*
65536
/
3
]
*
2
).
astype
(
'int64'
)
share
=
lambda
x
:
np
.
array
([
x
*
mdu
.
mpc_one_share
]
*
2
).
astype
(
'int64'
)
input
=
np
.
random
.
random
(
self
.
input_size
)
filter
=
np
.
random
.
uniform
(
-
1
,
1
,
self
.
filter_size
)
...
...
@@ -385,7 +385,7 @@ class TestConv2dOp_v2(OpTest):
'dilation'
:
self
.
dilations
}
share
=
lambda
x
:
np
.
array
([
x
*
65536
/
3
]
*
2
).
astype
(
'int64'
)
share
=
lambda
x
:
np
.
array
([
x
*
mdu
.
mpc_one_share
]
*
2
).
astype
(
'int64'
)
input
=
np
.
random
.
random
(
self
.
input_size
)
filter
=
np
.
random
.
uniform
(
-
1
,
1
,
self
.
filter_size
)
...
...
python/paddle_fl/mpc/tests/unittests/test_op_metric.py
浏览文件 @
08ea0b2a
...
...
@@ -20,6 +20,7 @@ import unittest
import
numpy
as
np
import
paddle.fluid
as
fluid
import
paddle_fl.mpc
as
pfl_mpc
import
mpc_data_utils
as
mdu
import
test_op_base
...
...
@@ -92,7 +93,7 @@ class TestOpPrecisionRecall(test_op_base.TestOpBase):
self
.
threshold
=
np
.
random
.
random
()
preds
,
labels
=
[],
[]
self
.
exp_res
=
(
0
,
[
0
]
*
3
)
share
=
lambda
x
:
np
.
array
([
x
*
65536
/
3
]
*
2
).
astype
(
'int64'
).
reshape
(
share
=
lambda
x
:
np
.
array
([
x
*
mdu
.
mpc_one_share
]
*
2
).
astype
(
'int64'
).
reshape
(
[
2
]
+
self
.
input_size
)
for
_
in
range
(
n
):
...
...
python/paddle_fl/mpc/tests/unittests/test_op_pool.py
浏览文件 @
08ea0b2a
...
...
@@ -54,15 +54,15 @@ class TestOpPool2d(test_op_base.TestOpBase):
def
test_pool2d
(
self
):
data_1
=
np
.
array
(
[[[[
1
,
2
,
3
,
4
,
0
,
100
],
[
5
,
6
,
7
,
8
,
0
,
100
],
[[[[
1
,
2
,
3
,
4
,
0
,
100
],
[
5
,
6
,
7
,
8
,
0
,
100
],
[
9
,
10
,
11
,
12
,
0
,
200
],
[
13
,
14
,
15
,
16
,
0
,
200
]]]]).
astype
(
'float32'
)
expected_out
=
np
.
array
(
[[[[
6
,
8
,
100
],
[[[[
6
,
8
,
100
],
[
14
,
16
,
200
]]]]).
astype
(
'float32'
)
print
(
"input data_1: {}
\n
"
.
format
(
data_1
))
#
print("input data_1: {} \n".format(data_1))
data_1_shares
=
aby3
.
make_shares
(
data_1
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录