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 )
Defined in tensorflow/contrib/lite/python/lite.py
.
Convert a model using TOCO from input_format
to output_format
.
Typically this is to convert from TensorFlow GraphDef to TFLite, in which case the default input_format
and output_format
are sufficient.
input_data
: Input data (i.e. often sess.graph_def
).input_tensors
: List of input tensors. Type and shape are computed using foo.get_shape()
and foo.dtype
.output_tensors
: List of output tensors (only .name is used from this).inference_type
: Currently must be {FLOAT, QUANTIZED_UINT8}
.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 inference_type
is QUANTIZED_UINT8
.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 unknownRuntimeError
: If TOCO fails to convert (in which case the runtime error's error text will contain the TOCO error log)
© 2018 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_docs/python/tf/contrib/lite/toco_convert