serizba / cppflow

Run TensorFlow models in C++ without installation and without Bazel
https://serizba.github.io/cppflow/
MIT License
788 stars 178 forks source link

Cant build example, getting following errors for tensorflow2 #133

Closed SangaRavi closed 3 years ago

SangaRavi commented 3 years ago

make Scanning dependencies of target example [ 50%] Building CXX object CMakeFiles/example.dir/main.cpp.o In file included from /home/linuxuser/cppflow/examples/load_model/main.cpp:4:0: /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h: In member function ‘std::vector cppflow::model::operator()(std::vector<std::tuple<std::cxx11::basic_string<char, std::char_traits, std::allocator >, cppflow::tensor> >, std::vector<std::cxx11::basic_string >)’: /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h:130:23: error: expected unqualified-id before ‘[’ token const auto[op_name, op_idx] = parse_name(std::get<0>(inputs[i])); ^ /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h:131:74: error: ‘op_name’ was not declared in this scope inp_ops[i].oper = TF_GraphOperationByName(this->graph.get(), op_name.c_s ^ /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h:132:32: error: ‘op_idx’ was not declared in this scope inp_ops[i].index = op_idx; ^ /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h:145:23: error: expected unqualified-id before ‘[’ token const auto[op_name, op_idx] = parse_name(outputs[i]); ^ /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h:146:74: error: ‘op_name’ was not declared in this scope out_ops[i].oper = TF_GraphOperationByName(this->graph.get(), op_name.c_s ^ /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h:147:32: error: ‘op_idx’ was not declared in this scope out_ops[i].index = op_idx; ^ /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h: In member function ‘cppflow::tensor cppflow::model::operator()(const cppflow::tensor&)’: /home/linuxuser/cppflow/examples/load_model/../../include/cppflow/model.h:170:89: error: converting to ‘std::tuple<std::__cxx11::basic_string<char, std::char_traits, std::allocator >, cppflow::tensor>’ from initializer list would use explicit constructor ‘constexpr std::tuple<_T1, _T2>::tuple(_U1&&, _U2&&) [with _U1 = const char (&)[24]; _U2 = const cppflow::tensor&; = void; _T1 = std::__cxx11::basic_string; _T2 = cppflow::tensor]’ (*this)({{"serving_default_input_1", input}}, {"StatefulPartitionedCall"})[0]; ^ CMakeFiles/example.dir/build.make:62: recipe for target 'CMakeFiles/example.dir/main.cpp.o' failed make[2]: [CMakeFiles/example.dir/main.cpp.o] Error 1 CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/example.dir/all' failed make[1]: [CMakeFiles/example.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

SangaRavi commented 3 years ago

Enabling c++ 17 builds it fine