https://github.com/chunyang-wen/prototext-tensorflow
generate pb_text* from proto in tensorflow
https://github.com/chunyang-wen/prototext-tensorflow
protobuf prototext tensorflow
Last synced: about 1 month ago
JSON representation
generate pb_text* from proto in tensorflow
- Host: GitHub
- URL: https://github.com/chunyang-wen/prototext-tensorflow
- Owner: chunyang-wen
- Created: 2018-02-23T10:20:45.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-06-18T16:17:53.000Z (almost 6 years ago)
- Last Synced: 2024-12-28T06:25:42.926Z (over 1 year ago)
- Topics: protobuf, prototext, tensorflow
- Language: C++
- Homepage:
- Size: 21.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
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:
```bash
brew install automake libtool
```
```bash
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
```CMake
INCLUDE_DIRECTORIES({path-to-output}/include)
TARGET_LINK_LIBRARIES({path-to-output}/lib)
```
### Execute command
```bash
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"' {} \;
```