提交 92c293ac 编写于 作者: Y Yiqun Liu 提交者: GitHub

Merge pull request #3794 from Xreki/fix_mac_compiling_std_move

Update the version of OpenBLAS and fix compiling error caused by std::move on Mac
...@@ -25,7 +25,12 @@ IF(NOT ${CBLAS_FOUND}) ...@@ -25,7 +25,12 @@ IF(NOT ${CBLAS_FOUND})
"${CBLAS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}openblas${CMAKE_STATIC_LIBRARY_SUFFIX}" "${CBLAS_INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}openblas${CMAKE_STATIC_LIBRARY_SUFFIX}"
CACHE FILEPATH "openblas library." FORCE) CACHE FILEPATH "openblas library." FORCE)
IF(APPLE)
SET(OPENBLAS_CC "${CMAKE_C_COMPILER} -isysroot ${CMAKE_OSX_SYSROOT}")
SET(COMMON_ARGS CC=${OPENBLAS_CC} NO_SHARED=1 NO_LAPACK=1 libs)
ELSE()
SET(COMMON_ARGS CC=${CMAKE_C_COMPILER} NO_SHARED=1 NO_LAPACK=1 libs) SET(COMMON_ARGS CC=${CMAKE_C_COMPILER} NO_SHARED=1 NO_LAPACK=1 libs)
ENDIF()
IF(CMAKE_CROSSCOMPILING) IF(CMAKE_CROSSCOMPILING)
IF(ANDROID) IF(ANDROID)
...@@ -40,11 +45,11 @@ IF(NOT ${CBLAS_FOUND}) ...@@ -40,11 +45,11 @@ IF(NOT ${CBLAS_FOUND})
SET(OPTIONAL_ARGS HOSTCC=${HOST_C_COMPILER} TARGET=${TARGET} ARM_SOFTFP_ABI=1 USE_THREAD=0) SET(OPTIONAL_ARGS HOSTCC=${HOST_C_COMPILER} TARGET=${TARGET} ARM_SOFTFP_ABI=1 USE_THREAD=0)
ELSEIF(RPI) ELSEIF(RPI)
# use hardfp # use hardfp
SET(OPENBLAS_COMMIT "v0.2.19") SET(OPENBLAS_COMMIT "v0.2.20")
SET(OPTIONAL_ARGS HOSTCC=${HOST_C_COMPILER} TARGET=ARMV7 USE_THREAD=0) SET(OPTIONAL_ARGS HOSTCC=${HOST_C_COMPILER} TARGET=ARMV7 USE_THREAD=0)
ENDIF() ENDIF()
ELSE() ELSE()
SET(OPENBLAS_COMMIT "v0.2.19") SET(OPENBLAS_COMMIT "v0.2.20")
SET(OPTIONAL_ARGS "") SET(OPTIONAL_ARGS "")
IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^x86(_64)?$") IF(CMAKE_SYSTEM_PROCESSOR MATCHES "^x86(_64)?$")
SET(OPTIONAL_ARGS DYNAMIC_ARCH=1 NUM_THREADS=64) SET(OPTIONAL_ARGS DYNAMIC_ARCH=1 NUM_THREADS=64)
......
...@@ -223,7 +223,7 @@ void CrossEntropyOverBeam::checkInputs() { ...@@ -223,7 +223,7 @@ void CrossEntropyOverBeam::checkInputs() {
<< inputLayers_[i * 3]->getName() << inputLayers_[i * 3]->getName()
<< " should be a nested sequence"; << " should be a nested sequence";
CHECK_EQ(getInputValue(i * 3 + 1)->getWidth(), beamSize_); CHECK_EQ(getInputValue(i * 3 + 1)->getWidth(), beamSize_);
CHECK_EQ(scores.getNumSequences(), batchSize_); CHECK_EQ(batchSize_, static_cast<size_t>(scores.getNumSequences()));
CHECK_EQ(scores.getNumSubSequences(), selCandidates.getBatchSize()); CHECK_EQ(scores.getNumSubSequences(), selCandidates.getBatchSize());
} else { } else {
CHECK(scores.hasSeq()) << "input " << i << " " CHECK(scores.hasSeq()) << "input " << i << " "
...@@ -231,10 +231,10 @@ void CrossEntropyOverBeam::checkInputs() { ...@@ -231,10 +231,10 @@ void CrossEntropyOverBeam::checkInputs() {
<< " should be a sequence"; << " should be a sequence";
batchSize_ = scores.getNumSequences(); batchSize_ = scores.getNumSequences();
beamSize_ = getInputValue(i * 3 + 1)->getWidth(); beamSize_ = getInputValue(i * 3 + 1)->getWidth();
CHECK_EQ(batchSize_, selCandidates.getBatchSize()); CHECK_EQ(batchSize_, static_cast<size_t>(selCandidates.getBatchSize()));
} }
CHECK_EQ(1U, scores.value->getWidth()); CHECK_EQ(1U, scores.value->getWidth());
CHECK_EQ(batchSize_, goldSeq.getBatchSize()); CHECK_EQ(batchSize_, static_cast<size_t>(goldSeq.getBatchSize()));
} }
} }
...@@ -377,8 +377,8 @@ void CrossEntropyOverBeam::forward(PassType passType) { ...@@ -377,8 +377,8 @@ void CrossEntropyOverBeam::forward(PassType passType) {
MatrixPtr outputValue = getOutputValue(); MatrixPtr outputValue = getOutputValue();
for (size_t i = 0; i < batchSize_; ++i) { for (size_t i = 0; i < batchSize_; ++i) {
beamCosts_[i].setData( BeamExpansionPtr ptr = std::make_shared<BeamExpansion>(beamPerSeq_[i]);
std::move(std::make_shared<BeamExpansion>(beamPerSeq_[i])), beamSize_); beamCosts_[i].setData(std::move(ptr), beamSize_);
outputValue->getData()[i] = beamCosts_[i].forward(); outputValue->getData()[i] = beamCosts_[i].forward();
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册