Issue 1:
System information

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

IMAGE_SIZE=224 toco \ --input_file=tf_files/retrained_graph.pb \ --output_file=tf_files/optimized_graph.tflite \ --input_format=TENSORFLOW_GRAPHDEF \ --output_format=TFLITE \ --input_shape=1,${IMAGE_SIZE},${IMAGE_SIZE},3 \ --input_array=input \ --output_array=final_result \ --inference_type=FLOAT \ --input_data_type=FLOAT

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

Im using windows subsytems for linux

TensorFlow version (use command below):

tensorflow 1.12

Python version:

2.7

Describe the current behavior

i want to convert my custom model to tflite as stated in this but it gives a toco error saying toco: error: argument --output_file is required

Other info / logs

this was the whole log:

usage: toco [-h] --output_file OUTPUT_FILE (--graph_def_file GRAPH_DEF_FILE | --saved_model_dir SAVED_MODEL_DIR | --keras_model_file KERAS_MODEL_FILE) [--output_format {TFLITE,GRAPHVIZ_DOT}] [--inference_type {FLOAT,QUANTIZED_UINT8}] [--inference_input_type {FLOAT,QUANTIZED_UINT8}] [--input_arrays INPUT_ARRAYS] [--input_shapes INPUT_SHAPES] [--output_arrays OUTPUT_ARRAYS] [--saved_model_tag_set SAVED_MODEL_TAG_SET] [--saved_model_signature_key SAVED_MODEL_SIGNATURE_KEY] [--std_dev_values STD_DEV_VALUES] [--mean_values MEAN_VALUES] [--default_ranges_min DEFAULT_RANGES_MIN] [--default_ranges_max DEFAULT_RANGES_MAX] [--post_training_quantize] [--drop_control_dependency] [--reorder_across_fake_quant] [--change_concat_input_ranges {TRUE,FALSE}] [--allow_custom_ops] [--converter_mode {DEFAULT,TOCO_FLEX,TOCO_FLEX_ALL}] [--dump_graphviz_dir DUMP_GRAPHVIZ_DIR] [--dump_graphviz_video] toco: error: argument --output_file is required

Issue 2:
System information

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

OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04 virtual machine that is run on legitimate Windows 10 OS

Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A

TensorFlow installed from (source or binary): github.com/googlecodelabs/tensorflow-for-poets-2

TensorFlow version (use command below): 1.9.0 (also tested 1.5.0, and 1.8.0)

Python version: 3.6

Bazel version (if compiling from source): 0.15.2

GCC/Compiler version (if compiling from source): N/A

CUDA/cuDNN version: N/A? the tf_env_collect.sh program didnt pull any information on this

GPU model and memory:Rx480 with 4gb of ram

Exact command to reproduce:

/home/(user name)/.local/bin/toco

— input_file=tf_files/retrained_graph.pb

— output_file=tf_files/optimized_graph.lite

— input_format=TENSORFLOW_GRAPHDEF

— output_format=TFLITE

— input_shape=1,224,224,3

— input_array=input

— output_array=final_result

— inference_type=FLOAT

— input_data_type=FLOAT

taken from THIS tutorial:

https://heartbeat.fritz.ai/working-through-a-tensorflow-lite-tutorial-on-windows-10-e27ee0e8b8cc

(I followed the tutorial pretty much word for word, virtual ubuntu machine and everything since TOCO never worked originally on my windows machine.)

Describe the problem

Describe the problem clearly here. Be sure to convey here why it's a bug in TensorFlow or a feature request.git

When I executed the command above after following the directions of that tutorial, originally with tensorflow 1.5.0 installed, the command failes saying

"Check failed: parsed_toco_flags.input_format.specified() Missing required flag: input_format

Aborted (core dumped)"

I'm a novice in tensor flow programming but doesn't the command specify input_format?

I looked on other github issues with a similar problem and the experts suggested upgrading tensorflow to 1.8.0 which only results in issues like missing module attributes or import errors. Its probably much more likely that I'm doing something wrong rather than there being a bug with tensorflow, but I'm just so confused as to what mistake I made; I need some expert help.

Source code / logs

Include any logs or source code that would be helpful to diagnose the problem. If including tracebacks, please include the full traceback. Large logs and files should be attached. Try to provide a reproducible test case that is the bare minimum necessary to generate the problem.

v. 1.5.0

ubuntu@ubuntu:~$ /home/ubuntu/.local/bin/toco \— input_file=tf_files/retrained_graph.pb \— output_file=tf_files/optimized_graph.lite \— input_format=TENSORFLOW_GRAPHDEF \— output_format=TFLITE \— input_shape=1,224,224,3 \— input_array=input \— output_array=final_result \— inference_type=FLOAT \— input_data_type=FLOAT

2018-07-20 01:55:55.974573: F tensorflow/contrib/lite/toco/toco_cmdline_flags.cc:165] Check failed: parsed_toco_flags.input_format.specified() Missing required flag: input_format

Aborted (core dumped)

v. 1.8.0

ubuntu@ubuntu:~$ /home/ubuntu/.local/bin/toco \— input_file=tf_files/retrained_graph.pb \— output_file=tf_files/optimized_graph.lite \— input_format=TENSORFLOW_GRAPHDEF \— output_format=TFLITE \— input_shape=1,224,224,3 \— input_array=input \— output_array=final_result \— inference_type=FLOAT \— input_data_type=FLOAT

Traceback (most recent call last):

File "/home/ubuntu/.local/bin/toco", line 7, in

from tensorflow.contrib.lite.toco.python.toco_wrapper import main

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/init.py", line 24, in

from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/init.py", line 63, in

from tensorflow.python.framework.framework_lib import * # pylint: disable=redefined-builtin

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/framework/framework_lib.py", line 104, in

from tensorflow.python.framework.importer import import_graph_def

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/framework/importer.py", line 32, in

from tensorflow.python.framework import function

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/framework/function.py", line 36, in

from tensorflow.python.ops import resource_variable_ops

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 35, in

from tensorflow.python.ops import variables

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 40, in

class Variable(checkpointable.CheckpointableBase):

AttributeError: module 'tensorflow.python.training.checkpointable' has no attribute 'CheckpointableBase'

v. 1.9.0

ubuntu@ubuntu:~$ /home/ubuntu/.local/bin/toco \— input_file=tf_files/retrained_graph.pb \— output_file=tf_files/optimized_graph.lite \— input_format=TENSORFLOW_GRAPHDEF \— output_format=TFLITE \— input_shape=1,224,224,3 \— input_array=input \— output_array=final_result \— inference_type=FLOAT \— input_data_type=FLOAT

Traceback (most recent call last):

File "/home/ubuntu/.local/bin/toco", line 7, in

from tensorflow.contrib.lite.python.tflite_convert import main

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/init.py", line 22, in

from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/init.py", line 81, in

from tensorflow.python import keras

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/keras/init.py", line 24, in

from tensorflow.python.keras import activations

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/keras/activations/init.py", line 22, in

from tensorflow.python.keras._impl.keras.activations import elu

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/init.py", line 21, in

from tensorflow.python.keras._impl.keras import activations

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/activations.py", line 23, in

from tensorflow.python.keras._impl.keras import backend as K

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/keras/_impl/keras/backend.py", line 38, in

from tensorflow.python.layers import base as tf_base_layers

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/layers/base.py", line 25, in

from tensorflow.python.keras.engine import base_layer

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/init.py", line 21, in

from tensorflow.python.keras.engine.base_layer import InputSpec

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py", line 33, in

from tensorflow.python.keras import backend

File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/keras/backend/init.py", line 22, in

from tensorflow.python.keras._impl.keras.backend import abs

ImportError: cannot import name 'abs'