diff --git a/Makefile b/Makefile index 26f2dcf..d59b318 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ example-pycxpress: example-graph: ./sample/saved_model/saved_model.pb ./sample/saved_model/saved_model.pb: ./sample/main.py - env -C $(THIS_MAKEFILE_DIR)/sample $(PYTHON) main.py + env -C $(THIS_MAKEFILE_DIR)/sample --unset=LD_LIBRARY_PATH $(PYTHON) main.py example-tensorflow: build-sample example-graph $(call message, Run ./build/sample/sample) @@ -75,6 +75,7 @@ else CMAKE_OPTIONS += -DCMAKE_PREFIX_PATH="$(REPO_DIR)/third_party/protobuf" endif endif +CMAKE_OPTIONS += -DUSE_LIBTENSORFLOW_CC=$(USE_LIBTENSORFLOW_CC) ifneq ($(TYPE),) BUILD_TYPE_R := Release @@ -195,9 +196,11 @@ format-cpp: #[Format.$(CMAKE)](https://github.com/TheLartians/Format.cmake) format-cmake: $(call message, Source CMAKE) - $(CMAKE) -S tests -B build/tests $(CMAKE_OPTIONS) + $(CMAKE) -B build $(CMAKE_OPTIONS) $(call message, Format) $(CMAKE) --build build --target fix-format + $(call message, Revert back all those tensorflow proto changes because of clang-format bug) + -git checkout src/TensorflowCpy/proto/tensorflow/ #* Linting .PHONY: test test-pycxpress test-tfcpy @@ -277,5 +280,6 @@ cleanup: pycache-remove dsstore-remove mypycache-remove ipynbcheckpoints-remove distclean: cleanup rm -rf $(REPO_DIR)/dist/ rm -rf $(REPO_DIR)/build/ + rm -rf $(REPO_DIR)/sample/frozen_graph $(REPO_DIR)/sample/saved_model FORCE: diff --git a/sample/main.cpp b/sample/main.cpp index e720170..4f592da 100644 --- a/sample/main.cpp +++ b/sample/main.cpp @@ -63,13 +63,13 @@ auto main(int argc, char** argv) -> int { std::string name; - // clang-format off - options.add_options() - ("h,help", "Show help") - ("v,version", "Print the current version number") - ("n,name", "Name to greet", cxxopts::value(name)->default_value("whole_flow")) - ; - // clang-format on + options.add_options() + // clang-format off + ("h,help", "Show help") + ("v,version", "Print the current version number") + ("n,name", "Name to greet", cxxopts::value(name)->default_value("whole_flow")) + // clang-format on + ; auto result = options.parse(argc, argv); diff --git a/src/TensorflowCpy/proto/CMakeLists.txt b/src/TensorflowCpy/proto/CMakeLists.txt index e9640e9..b04e282 100644 --- a/src/TensorflowCpy/proto/CMakeLists.txt +++ b/src/TensorflowCpy/proto/CMakeLists.txt @@ -1,9 +1,9 @@ find_package(Protobuf CONFIG REQUIRED) -file(GLOB_RECURSE protos CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tensorflow/**/*.proto") +file(GLOB_RECURSE tf_protos CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/tensorflow/**/*.proto") -add_library(proto-objects OBJECT ${protos}) -set(PROTO_BINARY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../include") +add_library(proto-objects OBJECT ${tf_protos}) +set(PROTO_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}") make_directory(${PROTO_BINARY_DIR}) protobuf_generate( diff --git a/src/TensorflowCpy/source/framework.cpp b/src/TensorflowCpy/source/framework.cpp index bf744d9..c9827bb 100644 --- a/src/TensorflowCpy/source/framework.cpp +++ b/src/TensorflowCpy/source/framework.cpp @@ -18,6 +18,8 @@ void wait_for_debugger_attach() { } #pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunknown-warning-option" + #pragma GCC diagnostic ignored "-Wunused-parameter" #pragma GCC diagnostic ignored "-Wpedantic" #pragma GCC diagnostic ignored "-Wdeprecated-builtins" @@ -49,11 +51,10 @@ namespace se = tensorflow_cpy::stream_executor; # include # include # include +# include # include # include -# include "tensorflow/core/platform/types.h" - namespace tf = tensorflow; namespace se = stream_executor; #endif @@ -89,6 +90,7 @@ int tensorflow_cpy::main_whole_flow(int argc, char** argv) { if (argc == 0) { return 1; } + std::string model_path(argv[1]); // configure session tf::SessionOptions sessionOption; @@ -138,7 +140,6 @@ int tensorflow_cpy::main_whole_flow(int argc, char** argv) { // load model tf::SavedModelBundle model; - std::string model_path(argv[1]); auto status = tf::LoadSavedModel(sessionOption, runOption, model_path, {"serve"}, &model); if (!status.ok()) { std::cerr << status.ToString() << std::endl;