Skip to content
 
 

Repository files navigation

Tensorflow has a tool called prototext.

It is bundled with Tensorflow so tightly. This repo extracts essential code.

Install google protobuf

You have to install protobuf and then change the locations in CMakeLists.txt

On Mac:

brew install automake libtool
git clone https://github.com/google/protobuf
# cd to protobuf directory
mkdir output
./autogen.sh
./configure --prefix={path-to-output}
make && make install

Modify CMakeLists.txt

INCLUDE_DIRECTORIES({path-to-output}/include)
TARGET_LINK_LIBRARIES({path-to-output}/lib)

Execute command

mkdir build
cd build && cmake ..
# generate a binary called `proto_text` with path={path-to-proto-text}

Generate tensorflow pb_text

# cd to the home to tensorflow

function bbbb() {
    cmd="{path-to-proto-text}" # generated by previous process
    file=$1
    # to remove ./
    file=${file:2}
    ${cmd} ${file}

    cmd="/path/to/protoc"
    SRC_DIR="./"
    DST_DIR=`dirname ${file}`
    ${cmd} -I=$SRC_DIR --cpp_out="." ${file}
}

export -f bbbb

find . -name "*.proto" -exec bash -c 'bbbb "$0"' {} \;

About

generate pb_text* from proto in tensorflow

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages