Issue 1:
Describe the problem

I want to load and run a single tensorflow model within another C++ project. To do this, I defined the tensorflow_all library in tensorflow/BUILD which should include all the necessary dependencies. (Details below)

When loading the tensorflow model via the C++ API (LoadSavedModel), the following runtime error occurs:

2017-07-28 13:36:41.875493: I tensorflow/cc/saved_model/loader.cc:284] Loading SavedModel: fail. Took 43550 microseconds.
terminate called after throwing an instance of 'std::runtime_error'
what(): Not found: Op type not registered 'BlockLSTM' in binary running on myMachine.
Make sure the Op and Kernel are registered in the binary running in this process.

I found that the BlockLSTM Op is registered in tensorflow/contrib/rnn/ops/lstm_ops.cc.

However, I could not find a way to include the operation BlockLSTM in my C++ library tensorflow_all.

Bear with me if this is actually not a bug (or even a feature request). I am still getting started with tensorflow.

Since my implementation is part of another larger project, it is currently difficult for me to give an easy to reproduce example. However, if this is necessary, I will do it as soon as I find the time.

System information

Have I written custom code (as opposed to using a stock example script provided in TensorFlow):

Yes, a colleague of mine trained a tensorflow graph which uses the BlockLSTM Op from tensorflow/contrib/rnn/ using the python API.

As mentioned before, I added code to the tensorflow/BUILD to create a library tensorflow_all. This library is used to load the graph externally.

cc_binary(
name = "libtensorflow_all.so",
linkshared = 1,
linkopts = ["-Wl,--version-script=tensorflow/tf_version_script.lds"],
deps = [
"//tensorflow/cc:cc_ops",
"//tensorflow/cc:client_session",
"//tensorflow/cc/saved_model:loader",
"//tensorflow/cc/saved_model:tag_constants",
"//tensorflow/core:all_kernels",
"//tensorflow/core:framework_internal",
"//tensorflow/core:tensorflow",
"//tensorflow/contrib:contrib_kernels",
"//tensorflow/contrib:contrib_ops_op_lib",
],
)

I was hoping that BlockLSTM was included in "//tensorflow/contrib:contrib_ops_op_lib", but that appears not to be the case.

OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 16.04.2 LTS

TensorFlow installed from (source or binary): source

TensorFlow version: Master branch (commit bb88ec7)

Python version: 3.5

Bazel version (if compiling from source): 0.4.5

CUDA/cuDNN version: 5.1

GPU model and memory: GeForce GTX 980, 4GB

Exact command to reproduce: Sorry. Not that easy to reproduce.

Issue 2:
I've trained the R-FCN model on my own training set. Now, I'd like to convert my frozen inference graph form the *.pb format to the *.tflite format to use it on an android mobile phone.

After training, I exported the frozen inference graph with the following command:

python3 export_inference_graph.py
--pipeline_config_path="training/ckpt/rfcn-69/pipeline.config"
--trained_checkpoint_prefix="training/ckpt/rfcn-69/model.ckpt-300000"
--output_directory="training/ckpt/rfcn-69/"

Afterwards I run the transform_graph util to quantize the graph. I noticed that it doesn't matter wether I run the transform_graph or not. In the end I'm getting the same error with both of the graphs.

bazel run tensorflow/tools/graph_transforms/transform_graph --
--in_graph="/git/bda/frozen_graphs/rfcn-69/frozen_inference_graph.pb"
--out_graph="/git/bda/frozen_graphs/rfcn-69/quantized_graph_2.pb"
--inputs=image_tensor
--outputs="num_detections,detection_boxes,detection_scores,detection_classes"
--transforms='fold_old_batch_norms quantize_weights strip_unused_nodes sort_by_execution_order obfuscate_names merge_duplicate_nodes'

Finally, I try to convert the quantized graph to an tflite graph with the toco util.

bazel run --config=opt tensorflow/contrib/lite/toco:toco --
--input_file=/git/bda/frozen_graphs/rfcn-69/quantized_graph_2.pb
--output_file=/git/bda/frozen_graphs/out.tflite --inference_type=FLOAT
--input_shape=1,600,1024,3
--input_array=image_tensor
--output_arrays=num_detections,detection_boxes,detection_scores,detection_classes

But, the operation fails with the following error.

2018-04-11 13:19:58.364591: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: TensorArrayV3
2018-04-11 13:19:58.364606: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: TensorArrayV3
2018-04-11 13:19:58.364656: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: TensorArrayReadV3
2018-04-11 13:19:58.364753: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: Where
2018-04-11 13:19:58.364851: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: Where
2018-04-11 13:19:58.364969: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: Dequantize
2018-04-11 13:19:58.365001: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: TensorArraySizeV3
2018-04-11 13:19:58.365022: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: Dequantize
2018-04-11 13:19:58.366115: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1253] Converting unsupported operation: Where
2018-04-11 13:20:00.620101: F tensorflow/contrib/lite/toco/tooling_util.cc:821] Check failed: d >= 1 (0 vs. 1)

I've got no clue what could be the problem. Any help would be highly appreciated.

Thanks in advance.