How to properly import Tensorflow source codes using Clion or Netbeans

I intend to read the core Tensorflow source module (TF)

My problem: I have no experience reading C / C ++ source codes such as TF in the IDE. Can someone give me some instructions on how to efficiently read the source code of TF (main module) in the IDE. I have Clion and Netbeans on my Macbook, but I don’t know how to import TF correctly (also what part to import ?, how to build it?), So when I want to know the declaration of one C ++ class I can go directly to his signature / declaration.

I will be grateful for any recommendations / recommended tools for reading TF source code efficiently. By the way, I assume that reading TF codes with the IDE is efficient. If this is not the case, I can stop using them and turn to tools like VIM.

+5
source share
2 answers

Tensorflow (GitHub) - , , , -, (Atom, Visual Studio, Sublime ..) , , .

, . Tensorflow Bazel , Eclipse Xcode. , , IDE.

+2

:

  1. CMakeLists.txt TF. ls -la :
tensorflow
third-party
tools
CMakeLists.txt
some
other
files
  1. CMakeLists.txt :

!!! , 800+. , . :

https://github.com/oleg-ostanin/tf_related_staff/blob/master/CMakeLists.txt

, , , .

cmake_minimum_required(VERSION 3.14)
project(tensorflow)

set(CMAKE_CXX_STANDARD 14)

# git clone https://github.com/abseil/abseil-cpp.git
include_directories(/home/oostanin/tf_related_repos/abseil-cpp)

# git clone https://github.com/protocolbuffers/protobuf.git
include_directories(/home/oostanin/tf_related_repos/protobuf/src/)

include_directories(/home/oostanin/tensorflow)

# you can get this directory only by building TF from sources using Bazel
include_directories(/home/oostanin/tensorflow/bazel-genfiles)

file(GLOB tensorflow_contrib_tensorrt_shape_fn "${CMAKE_SOURCE_DIR}/tensorflow/contrib/tensorrt/shape_fn/*.cc")
file(GLOB tensorflow_compiler_xla_service_llvm_ir "${CMAKE_SOURCE_DIR}/tensorflow/compiler/xla/service/llvm_ir/*.cc")
file(GLOB tensorflow_lite_delegates_gpu_gl "${CMAKE_SOURCE_DIR}/tensorflow/lite/delegates/gpu/gl/*.cc")
# here should be much more lines

add_library(
        tensorflow

        SHARED

        ${tensorflow_contrib_tensorrt_shape_fn}
        ${tensorflow_compiler_xla_service_llvm_ir}
        ${tensorflow_lite_delegates_gpu_gl}
        # here should be much more lines too
                )

target_link_libraries(
        tensorflow
        )

:

TF , - Cmake, . :

# git clone https://github.com/abseil/abseil-cpp.git
include_directories(/home/oostanin/tf_related_repos/abseil-cpp)

# git clone https://github.com/protocolbuffers/protobuf.git
include_directories(/home/oostanin/tf_related_repos/protobuf/src/)

, 2 , .

TF protobuf, TF , Bazel. , , , . Cmake, protobuf. :

include_directories(/home/oostanin/tensorflow/bazel-genfiles)

TF Bazel, , , , .

Cmake, TF, 300+ , .cc, :

file(GLOB tensorflow_contrib_tensorrt_shape_fn "${CMAKE_SOURCE_DIR}/tensorflow/contrib/tensorrt/shape_fn/*.cc")
file(GLOB tensorflow_compiler_xla_service_llvm_ir "${CMAKE_SOURCE_DIR}/tensorflow/compiler/xla/service/llvm_ir/*.cc")
file(GLOB tensorflow_lite_delegates_gpu_gl "${CMAKE_SOURCE_DIR}/tensorflow/lite/delegates/gpu/gl/*.cc")
# here should be much more lines

300+ , :

add_library(
        tensorflow

        SHARED

        ${tensorflow_contrib_tensorrt_shape_fn}
        ${tensorflow_compiler_xla_service_llvm_ir}
        ${tensorflow_lite_delegates_gpu_gl}
        # here should be much more lines too
                )

, TF, CMakeLists.txt, . TF CLion, , , VIM.

0

Source: https://habr.com/ru/post/1676091/


All Articles