aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md
diff options
context:
space:
mode:
authorGravatar Nupur Garg <nupurgarg@google.com>2018-06-28 17:56:16 -0700
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2018-06-28 17:58:51 -0700
commit78d7a7783aa7cf4a535f487c1da708f0c2f9cbed (patch)
tree025155a7e01404fe2d0403cb7304915a5fcec236 /tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md
parent9ab9d5e034625fbb9fa5e378127d6f6deb9ec59c (diff)
Updates TOCO documentation.
PiperOrigin-RevId: 202577530
Diffstat (limited to 'tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md')
-rw-r--r--tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md26
1 files changed, 22 insertions, 4 deletions
diff --git a/tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md b/tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md
index 0ab024c618..18b7848db8 100644
--- a/tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md
+++ b/tensorflow/contrib/lite/toco/g3doc/cmdline_examples.md
@@ -11,8 +11,10 @@ Table of contents:
* [Command-line tools](#tools)
* [Converting models prior to TensorFlow 1.9.](#pre-tensorflow-1.9)
-* [Convert a TensorFlow GraphDef](#graphdef)
-* [Convert a TensorFlow SavedModel](#savedmodel)
+* [Basic examples](#basic)
+ * [Convert a TensorFlow GraphDef](#graphdef)
+ * [Convert a TensorFlow SavedModel](#savedmodel)
+ * [Convert a tf.keras model](#keras)
* [Quantization](#quantization)
* [Convert a TensorFlow GraphDef for quantized inference](#graphdef-quant)
* [Use "dummy-quantization" to try out quantized inference on a float
@@ -51,7 +53,12 @@ API](python_api.md#pre-tensorflow-1.9). If a command line tool is desired, the
Terminal for additional details on the command-line flags available. There were
no command line tools in TensorFlow 1.8.
-## Convert a TensorFlow GraphDef <a name="graphdef"></a>
+## Basic examples <a name="basic"></a>
+
+The following section shows examples of how to convert a basic float-point model
+from each of the supported data formats into a TensorFlow Lite FlatBuffers.
+
+### Convert a TensorFlow GraphDef <a name="graphdef"></a>
The follow example converts a basic TensorFlow GraphDef (frozen by
[freeze_graph.py](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/freeze_graph.py))
@@ -70,7 +77,7 @@ tflite_convert \
The value for `input_shapes` is automatically determined whenever possible.
-## Convert a TensorFlow SavedModel <a name="savedmodel"></a>
+### Convert a TensorFlow SavedModel <a name="savedmodel"></a>
The follow example converts a basic TensorFlow SavedModel into a Tensorflow Lite
FlatBuffer to perform floating-point inference.
@@ -95,6 +102,17 @@ There is currently no support for MetaGraphDefs without a SignatureDef or for
MetaGraphDefs that use the [`assets/`
directory](https://www.tensorflow.org/guide/saved_model#structure_of_a_savedmodel_directory).
+### Convert a tf.Keras model <a name="keras"></a>
+
+The following example converts a `tf.keras` model into a TensorFlow Lite
+Flatbuffer. The `tf.keras` file must contain both the model and the weights.
+
+```
+tflite_convert \
+ --output_file=/tmp/foo.tflite \
+ --keras_model_file=/tmp/keras_model.h5
+```
+
## Quantization
### Convert a TensorFlow GraphDef for quantized inference <a name="graphdef-quant"></a>