diff --git a/cmake/hiredis.cmake b/cmake/hiredis.cmake deleted file mode 100644 index 33a45eef1ea85816c9cfdf112baa01146354c043..0000000000000000000000000000000000000000 --- a/cmake/hiredis.cmake +++ /dev/null @@ -1,37 +0,0 @@ -# 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 diff --git a/core/paddlefl_mpc/operators/mpc_elementwise_add_op.h b/core/paddlefl_mpc/operators/mpc_elementwise_add_op.h index 953a7e6e261c9f10646d51f9bdedb144942ca0b7..d30f3aa998a53922bfb2557b5ff1b2c1c200f7c5 100644 --- a/core/paddlefl_mpc/operators/mpc_elementwise_add_op.h +++ b/core/paddlefl_mpc/operators/mpc_elementwise_add_op.h @@ -106,9 +106,9 @@ template class MpcElementwiseAddKernel : public MpcOpKernel { public: void ComputeImpl(const framework::ExecutionContext &ctx) const override { - auto *in_x_t = ctx.Input("X"); - auto *in_y_t = ctx.Input("Y"); - auto *out_t = ctx.Output("Out"); + auto *in_x_t = ctx.Input("X"); + auto *in_y_t = ctx.Input("Y"); + auto *out_t = ctx.Output("Out"); int axis = ctx.Attr("axis"); diff --git a/python/paddle_fl/mpc/data_utils/aby3.py b/python/paddle_fl/mpc/data_utils/aby3.py index 49f95ce9de59ba5ecacebfa9b23abd5d9b49fd5b..a73183cc2c6507c82f7a59b232e0c32d8de13e54 100644 --- a/python/paddle_fl/mpc/data_utils/aby3.py +++ b/python/paddle_fl/mpc/data_utils/aby3.py @@ -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)