在 C++ 项目中使用 CNTKlibrary.h 进行评估
Evaluation with CNTKlibrary.h in C++ Project
我已经使用 BrainScript 训练了我的模型,现在想在 C++ 项目中使用它。来自EvalMultithreads.cpp I copied all the relevant functions. I linked the CNTK.Core and CNTK.Math library and set their search path as described here。当然,我包括了 CNTKLibrary.h。
当我构建项目时,编译器给我这个错误:
undefined reference to `CNTK::Variable::Name[abi:cxx11]() const'
它指的是这一行:
if (it->Name().compare(varName) == 0)
的 EvalMultithreads.cpp 函数 bool GetVariableByName,还有 :
undefined reference to `CNTK::Function::LoadModel(std::__cxx11::basic_string CMakeFiles/xxx.dir/build.make:1848: recipe for target '/home/path/xxx.exe' failed
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/xxx.dir/all' failed
Makefile:83: recipe for target 'all' failed
有没有人遇到同样的问题?
仅供参考:我正在使用 Ubuntu 16.04
、gcc
版本 5.4.0
、具有 1 位 SGD
的 CNTK ver2.0rc2 GPU
二进制发布包中的CNTK.Core和其他库是用GCC 4.8编译的,所以不能直接链接到使用gcc 5.4.0的应用程序。请使用相同的构建风格 (Debug/Release) 和 the same compiler version as the one used to create the libraries, as described here。
如果要使用 gcc 5.4.0,则需要从源代码构建库。
我已经使用 BrainScript 训练了我的模型,现在想在 C++ 项目中使用它。来自EvalMultithreads.cpp I copied all the relevant functions. I linked the CNTK.Core and CNTK.Math library and set their search path as described here。当然,我包括了 CNTKLibrary.h。 当我构建项目时,编译器给我这个错误:
undefined reference to `CNTK::Variable::Name[abi:cxx11]() const'
它指的是这一行:
if (it->Name().compare(varName) == 0)
的 EvalMultithreads.cpp 函数 bool GetVariableByName,还有 :
undefined reference to `CNTK::Function::LoadModel(std::__cxx11::basic_string CMakeFiles/xxx.dir/build.make:1848: recipe for target '/home/path/xxx.exe' failed CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/xxx.dir/all' failed Makefile:83: recipe for target 'all' failed
有没有人遇到同样的问题?
仅供参考:我正在使用 Ubuntu 16.04
、gcc
版本 5.4.0
、具有 1 位 SGD
二进制发布包中的CNTK.Core和其他库是用GCC 4.8编译的,所以不能直接链接到使用gcc 5.4.0的应用程序。请使用相同的构建风格 (Debug/Release) 和 the same compiler version as the one used to create the libraries, as described here。 如果要使用 gcc 5.4.0,则需要从源代码构建库。