tensorflow tools: can't figure out how to build/run summarize_graph
Asked Answered
B

2

6

I'm trying to convert my *.pb tensorflow model to coreML. I'm getting stuck on identifying my output node of my model.

In order to obtain my output node, I've attempted to build and run summarize_graph on my *.pb file, but running into issues. How do I build and run summarize_graph after downloading the source?

I've run the following command:

bazel build tensorflow/tools/graph_transforms:summarize_graph
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph --in_graph=tensorflow_inception_graph.pb

and I get the following error:

INFO: Analysed 0 targets (0 packages loaded). INFO: Found 0 targets... INFO: Elapsed time: 0.389s, Critical Path: 0.01s INFO: Build completed successfully, 1 total action bazel-bin/tensorflow/tools/graph_transforms/summarize_graph: No such file or directory

After issuing the bazel command, a blank bazel-bin directory appears in the location I executed the command.

Note, summarize_graph didn't exist in my tensorflow installation. So I downloaded the source from github tensorflow/tools/graph_transforms and copied it into my tensorflow/tools/graph_transforms directory.

the directory contains the following:

BUILD README.md init.py init.pyc add_default_attributes.cc add_default_attributes_test.cc backports.cc backports_test.cc compare_graphs.cc fake_quantize_training.cc fake_quantize_training_test.cc file_utils.cc file_utils.h file_utils_test.cc flatten_atrous.cc flatten_atrous_test.cc fold_batch_norms.cc fold_batch_norms_test.cc fold_constants_lib.cc fold_constants_lib.h fold_constants_test.cc fold_old_batch_norms.cc fold_old_batch_norms_test.cc freeze_requantization_ranges.cc freeze_requantization_ranges_test.cc fuse_convolutions.cc fuse_convolutions_test.cc insert_logging.cc insert_logging_test.cc obfuscate_names.cc obfuscate_names_test.cc out python quantize_nodes.cc quantize_nodes_test.cc quantize_weights.cc quantize_weights_test.cc remove_attribute.cc remove_attribute_test.cc remove_device.cc remove_device_test.cc remove_ema.cc remove_ema_test.cc remove_nodes.cc remove_nodes_test.cc rename_attribute.cc rename_attribute_test.cc rename_op.cc rename_op_test.cc round_weights.cc round_weights_test.cc set_device.cc set_device_test.cc sort_by_execution_order.cc sort_by_execution_order_test.cc sparsify_gather.cc sparsify_gather_test.cc strip_unused_nodes.cc strip_unused_nodes_test.cc summarize_graph_main.cc transform_graph.cc transform_graph.h transform_graph_main.cc transform_graph_test.cc transform_utils.cc transform_utils.h transform_utils_test.cc

I'm on a macbook pro

Thanks!

Briarroot answered 13/1, 2018 at 0:36 Comment(0)
B
4

In case anyone is running into the similar problem, I solved it.

Navigate to the root of the tensorflow source directory

cmd> ./configure
cmd> bazel build tensorflow/tools/graph_transforms:summarize_graph

(you may get an error about xcode; if so, run the following)

cmd> xcode-select -s /Applications/Xcode.app/Contents/Developer

cmd> bazel clean --expunge

cmd> bazel build tensorflow/tools/graph_transforms:summarize_graph
Briarroot answered 13/1, 2018 at 1:58 Comment(2)
I'm at usr/miniconda3/lib/python3.6/site-packages/tensorflow but when I enter the command ./configure, it says -bash: ./configure: No such file or directoryChapen
@Chapen did you find solution for this? I am also using a virtualenv and do not have the environment as needed for bazel buildsCarminacarminative
H
1

CentOS 7 walkthrough:

yum install epel-release
yum update
yum install patch
curl https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repo -o /etc/yum.repos.d/vbatts-bazel-epel-7.repo
yum install bazel
curl -L -O https://github.com/tensorflow/tensorflow/archive/v1.8.0.tar.gz
cd tensorflow-1.8.0
./configure  # interactive!
bazel build tensorflow/tools/graph_transforms:summarize_graph
bazel-bin/tensorflow/tools/graph_transforms/summarize_graph
Haustellum answered 14/6, 2018 at 10:16 Comment(1)
Config value cuda is not defined in any .rc fileColombo

© 2022 - 2024 — McMap. All rights reserved.