tf.contrib.lite.toco_convert( input_data, input_tensors, output_tensors, inference_type=FLOAT, input_format=TENSORFLOW_GRAPHDEF, output_format=TFLITE, quantized_input_stats=None, drop_control_dependency=True )
Convert a model using TOCO from
Typically this is to convert from TensorFlow GraphDef to TFLite, in which
case the default
output_format are sufficient.
input_data: Input data (i.e. often
input_tensors: List of input tensors. Type and shape are computed using
output_tensors: List of output tensors (only .name is used from this).
inference_type: Currently must be
input_format: Type of data to read (currently must be TENSORFLOW_GRAPHDEF).
output_format: Type of data to write (currently must be TFLITE or GRAPHVIZ_DOT)
quantized_input_stats: For each member of input_tensors the mean and std deviation of training data. Only needed if
drop_control_dependency: Drops control dependencies silently. This is due to tf lite not supporting control dependencies.
The converted data. For example if tflite was the destination, then this will be a tflite flatbuffer in a bytes array.
ValueError: If the input tensor type is unknown
RuntimeError: If TOCO fails to convert (in which case the runtime error's error text will contain the TOCO error log)