我试图使用tensorflow TOCO和 tf_convert 工具将基于张量流(LSTM)的模型转换为tensorflow lite,但转换后的tensorflow lite模型大约为245MB,其中原始tensorflow移动大约为1MB .

以下是我使用的命令

bazel run --config=opt //tensorflow/contrib/lite/toco:toco -- \  
    --input_file= <inputfile> \
    --output_file= <outputfile> \
    --input_format=TENSORFLOW_GRAPHDEF \
    --output_format=TFLITE \
    --input_shape=1,1\
    --input_array=input\
    --output_array=output\
    --inference_type=QUANTIZED_UINT8 \
    --inference_type=FLOAT \
    --input_data_type=FLOAT \
    --allow_custom_ops

我已尝试使用 --allow_custom_ops 并且转换模型的大小与TOCO工具中的自定义操作相同/不相同 .

2018-08-27 18:09:18.538279:I tensorflow / contrib / lite / toco / graph_transformations / graph_transformations.cc:39]在删除未使用的操作数之前:4210运算符,6021数组(0量化)2018-08-27 18: 09:19.255416:I tensorflow / contrib / lite / toco / graph_transformations / graph_transformations.cc:39]在一般图形转换之前:4210个运算符,6021个数组(0个量化)2018-08-27 18:09:20.504422:I tensorflow / contrib /lite/toco/graph_transformations/graph_transformations.cc:39]一般图形转换后传递1:3604运算符,6008数组(0量化)2018-08-27 18:09:21.335526:I tensorflow / contrib / lite / toco / graph_transformations /graph_transformations.cc:39]在去量化图形转换之前:3604运算符,6008个数组(0量化)2018-08-27 18:09:21.897161:I tensorflow / contrib / lite / toco / allocate_transient_arrays.cc:329]总瞬态数组分配大小:15616字节,理论最佳值:15616字节 .

是否有任何计划在不久的将来支持LSTM相关业务的tensorflow?