如何将TensorFlow Lite模型量化为16位

如何将TensorFlow Lite模型量化为16位,tensorflow,neural-network,quantization,tensorflow-lite,Tensorflow,Neural Network,Quantization,Tensorflow Lite,下面的代码片段创建了一个8位量化TF-Lite模型,并将quantized_UINT8替换为FLOAT创建了一个32位模型。是否有创建16位量化模型的标志?我搜索了TF Lite文档,但在可能的标志列表中找不到任何文档。有人知道怎么做吗 ~/tensorflow/bazel-bin/tensorflow/contrib/lite/toco/toco \ --input_file=$(pwd)/model.pb \ --input_format=TENSORFLOW_GRAPHDEF \

下面的代码片段创建了一个8位量化TF-Lite模型,并将
quantized_UINT8
替换为
FLOAT
创建了一个32位模型。是否有创建16位量化模型的标志?我搜索了TF Lite文档,但在可能的标志列表中找不到任何文档。有人知道怎么做吗

~/tensorflow/bazel-bin/tensorflow/contrib/lite/toco/toco \
  --input_file=$(pwd)/model.pb \
  --input_format=TENSORFLOW_GRAPHDEF \
  --output_format=TFLITE \
  --output_file=$(pwd)/model.lite --inference_type=QUANTIZED_UINT8 \
  --input_type=QUANTIZED_UINT8 --input_arrays=conv2d_1_input \
  --default_ranges_min=0.0 --default_ranges_max=1.0 \
  --output_arrays=average_pooling2d_2/AvgPool --input_shapes=1024,32,32,2

目前,TFLite支持的唯一量化类型为8位。请看这里:

这是因为,对于现有的量化模型,8位是足够的,但这可能会改变。如果您有一个需要更多比特进行量化的模型,那么创建一个描述您的用例的TensorFlow问题可能是值得的