From 40141f749b3abbdb2a7baaf5b58c88d594b27cf2 Mon Sep 17 00:00:00 2001 From: minqiyang Date: Wed, 24 Oct 2018 23:36:48 +0800 Subject: [PATCH] Implement the unittest for hash op test=develop --- cmake/external/xxhash.cmake | 2 +- paddle/fluid/operators/hash_op.cc | 2 +- paddle/scripts/paddle_build.sh | 12 +++++----- .../fluid/tests/unittests/test_hash_op.py | 23 +++++++++++++++++-- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/cmake/external/xxhash.cmake b/cmake/external/xxhash.cmake index 293f11925..2028bfecf 100644 --- a/cmake/external/xxhash.cmake +++ b/cmake/external/xxhash.cmake @@ -16,7 +16,7 @@ ExternalProject_Add( CONFIGURE_COMMAND "" BUILD_IN_SOURCE 1 PATCH_COMMAND - BUILD_COMMAND make lib + BUILD_COMMAND sed -i "s/-Wstrict-prototypes -Wundef/-Wstrict-prototypes -Wundef -fPIC/g" ${XXHASH_SOURCE_DIR}/src/extern_xxhash/Makefile && make lib INSTALL_COMMAND export PREFIX=${XXHASH_INSTALL_DIR}/ && make install TEST_COMMAND "" ) diff --git a/paddle/fluid/operators/hash_op.cc b/paddle/fluid/operators/hash_op.cc index efa781ca2..b9ebe71a3 100644 --- a/paddle/fluid/operators/hash_op.cc +++ b/paddle/fluid/operators/hash_op.cc @@ -46,7 +46,7 @@ class HashOp : public framework::OperatorWithKernel { // keep the last dim to 1 out_dims.emplace_back(1); - ctx->SetOutputDim("Out", dims); + ctx->SetOutputDim("Out", framework::make_ddim(out_dims)); ctx->ShareLoD("X", /*->*/ "Out"); } }; diff --git a/paddle/scripts/paddle_build.sh b/paddle/scripts/paddle_build.sh index 85493c105..d6b9d1108 100755 --- a/paddle/scripts/paddle_build.sh +++ b/paddle/scripts/paddle_build.sh @@ -95,9 +95,9 @@ function cmake_gen() { exit 1 fi fi - else + else if [ "$1" != "" ]; then - echo "using python abi: $1" + echo "using python abi: $1" if [ "$1" == "cp27-cp27m" ]; then export LD_LIBRARY_PATH=/opt/_internal/cpython-2.7.11-ucs2/lib:${LD_LIBRARY_PATH#/opt/_internal/cpython-2.7.11-ucs4/lib:} export PATH=/opt/python/cp27-cp27m/bin/:${PATH} @@ -119,7 +119,7 @@ function cmake_gen() { fi fi fi - + if [ "$SYSTEM" == "Darwin" ]; then WITH_DISTRIBUTE=${WITH_DISTRIBUTE:-ON} WITH_AVX=${WITH_AVX:-ON} @@ -127,7 +127,7 @@ function cmake_gen() { else INFERENCE_DEMO_INSTALL_DIR=${INFERENCE_DEMO_INSTALL_DIR:-/root/.cache/inference_demo} fi - + cat <