<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: Yes</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>: Mac 10.13.3</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: source</li>
<li><strong>TensorFlow version (use command below)</strong>:  1.6</li>
<li><strong>Python version</strong>: 3.6.3</li>
<li><strong>Bazel version (if compiling from source)</strong>: 0.9</li>
<li><strong>CUDA/cuDNN version</strong>: 9/7</li>
<li><strong>GPU model and memory</strong>: 1080Ti &amp; 12G</li>
<li><strong>Exact command to reproduce</strong>:</li>
</ul>
<p dir="auto">I wrote MobileNet code to train a model from scratch. Also tried using MobileNet keras function for training but none of the model converts to tflite.</p>
<p dir="auto">I am running following command</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="./bazel-bin/tensorflow/contrib/lite/toco/toco --input_file=/MobileNet-trined.pb --input_format=TENSORFLOW_GRAPHDEF  --output_format=TFLITE --output_file=train-1.tflite --inference_type=FLOAT --input_arrays=input_1 --output_arrays=dense_1/Sigmoid --allow_custom_ops"><pre class="notranslate"><code class="notranslate">./bazel-bin/tensorflow/contrib/lite/toco/toco --input_file=/MobileNet-trined.pb --input_format=TENSORFLOW_GRAPHDEF  --output_format=TFLITE --output_file=train-1.tflite --inference_type=FLOAT --input_arrays=input_1 --output_arrays=dense_1/Sigmoid --allow_custom_ops
</code></pre></div>
<p dir="auto">It gives me following result</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2018-04-17 15:25:11.070338: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1236] Converting unsupported operation: RandomUniform
2018-04-17 15:25:11.098993: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 865 operators, 1364 arrays (0 quantized)
2018-04-17 15:25:11.139921: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] After Removing unused ops pass 1: 809 operators, 1280 arrays (0 quantized)
2018-04-17 15:25:11.183528: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 809 operators, 1280 arrays (0 quantized)
1984959600
2006980784
2018-04-17 15:25:11.184242: F tensorflow/contrib/lite/toco/graph_transformations/resolve_batch_normalization.cc:90] Check failed: mean_shape.dims() == multiplier_shape.dims() 
Abort trap: 6"><pre class="notranslate"><code class="notranslate">2018-04-17 15:25:11.070338: I tensorflow/contrib/lite/toco/import_tensorflow.cc:1236] Converting unsupported operation: RandomUniform
2018-04-17 15:25:11.098993: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 865 operators, 1364 arrays (0 quantized)
2018-04-17 15:25:11.139921: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] After Removing unused ops pass 1: 809 operators, 1280 arrays (0 quantized)
2018-04-17 15:25:11.183528: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 809 operators, 1280 arrays (0 quantized)
1984959600
2006980784
2018-04-17 15:25:11.184242: F tensorflow/contrib/lite/toco/graph_transformations/resolve_batch_normalization.cc:90] Check failed: mean_shape.dims() == multiplier_shape.dims() 
Abort trap: 6
</code></pre></div>
<h3 dir="auto">System information</h3>
<ul dir="auto">
<li><strong>Have I written custom code (as opposed to using a stock example script provided in TensorFlow)</strong>: yes</li>
<li><strong>OS Platform and Distribution (e.g., Linux Ubuntu 16.04)</strong>:  Ubuntu 16.04.4</li>
<li><strong>TensorFlow installed from (source or binary)</strong>: source</li>
<li><strong>TensorFlow version (use command below)</strong>:  r1.6 commit: <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/tensorflow/tensorflow/commit/cbc658095ae228f2f557af47e4901d552573aa15/hovercard" href="https://github.com/tensorflow/tensorflow/commit/cbc658095ae228f2f557af47e4901d552573aa15"><tt>cbc6580</tt></a></li>
<li><strong>Python version</strong>: 3.5.2</li>
<li><strong>Bazel version (if compiling from source)</strong>: 0.11.1</li>
<li><strong>GCC/Compiler version (if compiling from source)</strong>:  gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.9)</li>
<li><strong>CUDA/cuDNN version</strong>: N/A (build without support CUDA)</li>
<li><strong>GPU model and memory</strong>: N/A (build without support CUDA)</li>
<li><strong>Exact command to reproduce</strong>:</li>
</ul>
<h3 dir="auto">Describe the problem</h3>
<p dir="auto">Trained model, successfully froze, it works on the tensorflow android, using TensorFlowInferenceInterface.<br>
I try to convert this into a TF Lite format, but I get an error.</p>
<h3 dir="auto">Source code / logs</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="bazel-bin/tensorflow/contrib/lite/toco/toco \
    --input_file=./test_model/frozen_graph.pb \
    --input_format=TENSORFLOW_GRAPHDEF \
    --output_file=./test_model/unet.tflite \
    --output_format=TFLITE \
    --input_array='input' \
    --input_data_type=FLOAT \
    --input_shape=2,192,320,1 \
    --inference_type=FLOAT \
    --inference_input_type=FLOAT \
    --output_array='final/Sigmoid' \
    --v=1"><pre class="notranslate"><code class="notranslate">bazel-bin/tensorflow/contrib/lite/toco/toco \
    --input_file=./test_model/frozen_graph.pb \
    --input_format=TENSORFLOW_GRAPHDEF \
    --output_file=./test_model/unet.tflite \
    --output_format=TFLITE \
    --input_array='input' \
    --input_data_type=FLOAT \
    --input_shape=2,192,320,1 \
    --inference_type=FLOAT \
    --inference_input_type=FLOAT \
    --output_array='final/Sigmoid' \
    --v=1
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="2018-03-13 21:07:12.711948: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 282 operators, 479 arrays (0 quantized)
2018-03-13 21:07:12.716274: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 282 operators, 479 arrays (0 quantized)
2018-03-13 21:07:12.716893: F tensorflow/contrib/lite/toco/graph_transformations/resolve_batch_normalization.cc:86] Check failed: mean_shape.dims() == multiplier_shape.dims()
Aborted (core dumped)"><pre class="notranslate"><code class="notranslate">2018-03-13 21:07:12.711948: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before Removing unused ops: 282 operators, 479 arrays (0 quantized)
2018-03-13 21:07:12.716274: I tensorflow/contrib/lite/toco/graph_transformations/graph_transformations.cc:39] Before general graph transformations: 282 operators, 479 arrays (0 quantized)
2018-03-13 21:07:12.716893: F tensorflow/contrib/lite/toco/graph_transformations/resolve_batch_normalization.cc:86] Check failed: mean_shape.dims() == multiplier_shape.dims()
Aborted (core dumped)
</code></pre></div>