Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleFL
提交
62d028c8
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看板
提交
62d028c8
编写于
4月 30, 2020
作者:
J
jingqinghe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
上级
7da61872
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
7 addition
and
44 deletion
+7
-44
cmake/hiredis.cmake
cmake/hiredis.cmake
+0
-37
core/paddlefl_mpc/operators/mpc_elementwise_add_op.h
core/paddlefl_mpc/operators/mpc_elementwise_add_op.h
+3
-3
python/paddle_fl/mpc/data_utils/aby3.py
python/paddle_fl/mpc/data_utils/aby3.py
+4
-4
未找到文件。
cmake/hiredis.cmake
已删除
100644 → 0
浏览文件 @
7da61872
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
INCLUDE
(
ExternalProject
)
SET
(
HIREDIS_DIR
${
CMAKE_CURRENT_SOURCE_DIR
}
)
SET
(
HIREDIS_INCLUDE_DIRS
${
HIREDIS_DIR
}
)
SET
(
HIREDIS_NAME
"hiredis"
CACHE STRING
""
FORCE
)
SET
(
HIREDIS_URL
"https://paddlefl.bj.bcebos.com/hiredis.tar.gz"
CACHE STRING
""
FORCE
)
ExternalProject_Add
(
extern_hiredis
#URL https://paddlefl.bj.bcebos.com/hiredis.tar.gz
# GIT_REPOSITORY "https://github.com/redis/hiredis"
PREFIX
${
CMAKE_CURRENT_BINARY_DIR
}
/hiredis
SOURCE_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/hiredis
DOWNLOAD_DIR
${
CMAKE_CURRENT_BINARY_DIR
}
/hiredis
DOWNLOAD_COMMAND wget --no-check-certificate
${
HIREDIS_URL
}
-c -q -O
${
HIREDIS_NAME
}
.tar.gz
&& tar xf
${
HIREDIS_NAME
}
.tar.gz --strip-components 1
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND
""
BUILD_COMMAND make static
INSTALL_COMMAND
""
)
INCLUDE_DIRECTORIES
(
${
HIREDIS_INCLUDE_DIRS
}
)
message
(
STATUS
"
${
HIREDIS_INCLUDE_DIRS
}
"
)
ADD_LIBRARY
(
hiredis SHARED IMPORTED GLOBAL
)
ADD_DEPENDENCIES
(
hiredis extern_hiredis
)
\ No newline at end of file
core/paddlefl_mpc/operators/mpc_elementwise_add_op.h
浏览文件 @
62d028c8
...
...
@@ -106,9 +106,9 @@ template <typename DeviceContext, typename T>
class
MpcElementwiseAddKernel
:
public
MpcOpKernel
<
T
>
{
public:
void
ComputeImpl
(
const
framework
::
ExecutionContext
&
ctx
)
const
override
{
auto
*
in_x_t
=
ctx
.
Input
<
framework
::
LoDTensor
>
(
"X"
);
auto
*
in_y_t
=
ctx
.
Input
<
framework
::
LoDTensor
>
(
"Y"
);
auto
*
out_t
=
ctx
.
Output
<
framework
::
LoDTensor
>
(
"Out"
);
auto
*
in_x_t
=
ctx
.
Input
<
LoDTensor
>
(
"X"
);
auto
*
in_y_t
=
ctx
.
Input
<
LoDTensor
>
(
"Y"
);
auto
*
out_t
=
ctx
.
Output
<
LoDTensor
>
(
"Out"
);
int
axis
=
ctx
.
Attr
<
int
>
(
"axis"
);
...
...
python/paddle_fl/mpc/data_utils/aby3.py
浏览文件 @
62d028c8
...
...
@@ -90,7 +90,7 @@ def make_shares(num_array):
[c2, d2]]]
"""
old_size
=
num_array
.
size
flat_num_array
=
num_array
.
reshape
(
old_size
,
)
flat_num_array
=
num_array
.
reshape
(
old_size
,)
new_shape
=
(
SHARE_NUM
,
)
+
num_array
.
shape
result
=
np
.
empty
((
old_size
,
SHARE_NUM
),
dtype
=
np
.
int64
)
for
idx
in
six
.
moves
.
range
(
0
,
old_size
):
...
...
@@ -151,7 +151,7 @@ def save_aby3_shares(share_reader, part_name):
files
=
[
file0
,
file1
,
file2
]
for
shares
in
share_reader
():
for
idx
in
six
.
moves
.
range
(
0
,
3
):
# 3 parts
for
idx
in
six
.
moves
.
range
(
0
,
3
):
# 3 parts
share
=
get_aby3_shares
(
shares
,
idx
)
files
[
idx
].
write
(
share
.
tostring
())
...
...
@@ -211,12 +211,12 @@ def reconstruct(aby3_shares, type=np.float):
output:
[a, b], where a = decrypt(a0, a1, a2), b = decrypt(b0, b1, b2)
"""
if
len
(
aby3_shares
)
!=
3
:
# should collect shares from 3 parts
if
len
(
aby3_shares
)
!=
3
:
# should collect shares from 3 parts
raise
ValueError
(
"Number of aby3 shares should be 3 but was: {}"
.
format
(
len
(
aby3_shares
)))
raw_shares
=
aby3_shares
[:,
0
]
data_shape
=
raw_shares
.
shape
[
1
:]
# get rid of the first dim of [3, xxx]
data_shape
=
raw_shares
.
shape
[
1
:]
# get rid of the first dim of [3, xxx]
data_size
=
np
.
prod
(
data_shape
)
row_first_raw_shares
=
raw_shares
.
reshape
(
3
,
data_size
).
transpose
(
1
,
0
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录