int main(int argc, const char* argv[]) {
if (argc != 2) {
std::cerr << “usage: example-app \n”;
return -1;
}
cv::VideoCapture stream(0);
cv::namedWindow(“Gesture Detect”, cv::WINDOW_AUTOSIZE);
std::shared_ptrtorch::jit::script::Module module = torch::jit::load(argv[1]);
module->to(at::kCUDA);
…
it error fellow :
/Applications/CLion.app/Contents/bin/cmake/mac/bin/cmake --build /Users/yuchao/CLionProjects/untitled/cmake-build-debug --target untitled – -j 2
Scanning dependencies of target untitled
[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.o
/Users/yuchao/CLionProjects/untitled/main.cpp:53:49: error: no viable conversion from ‘script::Module’ to ‘std::shared_ptrtorch::jit::script::Module’
std::shared_ptrtorch::jit::script::Module module = torch::jit::load(argv[1]);
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3753:23: note: candidate constructor not viable: no known conversion from ‘script::Module’ to ‘std::nullptr_t’ (aka ‘nullptr_t’) for 1st argument
_LIBCPP_CONSTEXPR shared_ptr(nullptr_t) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3767:5: note: candidate constructor not viable: no known conversion from ‘script::Module’ to ‘const std::__1::shared_ptrtorch::jit::script::Module &’ for 1st argument
shared_ptr(const shared_ptr& __r) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3775:5: note: candidate constructor not viable: no known conversion from ‘script::Module’ to ‘std::__1::shared_ptrtorch::jit::script::Module &&’ for 1st argument
shared_ptr(shared_ptr&& __r) _NOEXCEPT;
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3770:9: note: candidate template ignored: could not match ‘shared_ptr’ against ‘torch::jit::script::Module’
shared_ptr(const shared_ptr<_Yp>& __r,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3776:52: note: candidate template ignored: could not match ‘shared_ptr’ against ‘torch::jit::script::Module’
template _LIBCPP_INLINE_VISIBILITY shared_ptr(shared_ptr<_Yp>&& __r,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3785:9: note: candidate template ignored: could not match ‘auto_ptr’ against ‘torch::jit::script::Module’
shared_ptr(auto_ptr<_Yp>&& __r,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3795:9: note: candidate template ignored: could not match ‘unique_ptr<type-parameter-0-0, type-parameter-0-1>’ against ‘torch::jit::script::Module’
shared_ptr(unique_ptr<_Yp, _Dp>&&,
^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/memory:3804:9: note: candidate template ignored: could not match ‘unique_ptr<type-parameter-0-0, type-parameter-0-1>’ against ‘torch::jit::script::Module’
shared_ptr(unique_ptr<_Yp, _Dp>&&,
^
1 error generated.
make[3]: *** [CMakeFiles/untitled.dir/main.cpp.o] Error 1
make[2]: *** [CMakeFiles/untitled.dir/all] Error 2
make[1]: *** [CMakeFiles/untitled.dir/rule] Error 2
make: *** [untitled] Error 2