【发布时间】:2018-07-10 23:48:33
【问题描述】:
伙计们,每当我尝试将我的 LSTM 图转换为 TFLite 时都会出错:
user@user:~/tensorflow/tensorflow$ bazel run --config=opt //tensorflow/contrib/lite/toco:toco -- --input_file=/home/user/model/rnn/lstm_graph_mobilnet_v2_100_128.pb --output_file=/home/user/model/rnn/lstm_graph_mobilnet_v2_100_128.tflite --input_format=TENSORFLOW_GRAPHDEF --output_format=TFLITE --inference_type=FLOAT --input_shape=1,10,2560 --input_array=input/x_input --output_array=output/y_pred
WARNING: ignoring http_proxy in environment.
.......................
WARNING: /home/user/.cache/bazel/_bazel_user/9944cfee49d745019014aac0edc80315/external/protobuf_archive/WORKSPACE:1: Workspace name in /home/user/.cache/bazel/_bazel_user/9944cfee49d745019014aac0edc80315/external/protobuf_archive/WORKSPACE (@com_google_protobuf) does not match the name given in the repository's definition (@protobuf_archive); this will cause a build error in future versions
INFO: Analysed target //tensorflow/contrib/lite/toco:toco (84 packages loaded).
INFO: Found 1 target...
Target //tensorflow/contrib/lite/toco:toco up-to-date:
bazel-bin/tensorflow/contrib/lite/toco/toco
INFO: Elapsed time: 88.490s, Critical Path: 35.68s
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/tensorflow/contrib/lite/toco/toco '--input_file=/home/user/model/rnn/lstm_graph_mobilnet_v2_100_128.pb' '--output_file=/home/users/model/rnn/lstm_graph_mobilnet_v2_100_128.tflite' '--input_format=TENSORFLOW_GRAPHDEF' '--output_format=TFLITE' '--inference_type=FLOAT' '--input_shape=1,10,2560' '--input_array=input/x_input' '--output_array=output/y_pred'
2018-07-10 16:38:59.794308: F tensorflow/contrib/lite/toco/tooling_util.cc:822] Check failed: d >= 1 (0 vs. 1)
在推理期间,batch size = 1,10 个输入,每个输入的长度为 2560
为什么我的维度为 0 in d >=1(0 vs. 1)?
任何将 RNN 转换为 TFLite 的示例项目?
【问题讨论】:
-
目前还没有简单的教程。我们正在努力改进工具并提供教程。
-
@aselle,这种方法在转换方面对我有用。我只是还没有在手机上测试过。我还注意到不支持量化的 8UINT 转换,所以当我转换它时,它最终成为 FLOAT 类型。让我们看看它在智能手机的 CPU 上的运行速度有多快(我没有 Pixel,所以我只能使用我的 CPU):github.com/tensorflow/tensorflow/issues/…
标签: python tensorflow rnn toco