Я использую toco_convert of tenorflow lite для некоторых старых работ.Это ошибки, которые я получаю для следующих команд:
toco\
--graph_def_file=6-graphmh-55epoc.pb \
--input_format=TENSORFLOW_GRAPHDEF \
--output_format=TFLITE \
--output_file=/leaves.tflite \
--inference_type=FLOAT \
--input_type=FLOAT \
--input_arrays=ImageTensor \
--output_arrays=SemanticPredictions \
--input_shapes=1,113,3 \
Я получаю следующую ошибку:
Traceback (most recent call last):
File "C:\Users\ash\AppData\Local\Continuum\anaconda3\envs\diec\Scripts\toco_from_protos-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\ash\AppData\Local\Continuum\anaconda3\envs\diec\lib\site-packages\tensorflow\lite\toco\python\toco_from_protos.py", line 59, in main
app.run(main=execute, argv=[sys.argv[0]] + unparsed)
File "C:\Users\ash\AppData\Local\Continuum\anaconda3\envs\diec\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
_sys.exit(main(argv))
File "C:\Users\ash\AppData\Local\Continuum\anaconda3\envs\diec\lib\site-packages\tensorflow\lite\toco\python\toco_from_protos.py", line 33, in execute
output_str = tensorflow_wrap_toco.TocoConvert(model_str, toco_str, input_str)
Exception: We are continually in the process of adding support to TensorFlow Lite for more ops. It would be helpful if you could inform us of how this conversion went by opening a github issue at https://github.com/tensorflow/tensorflow/issues/new?template=40-tflite-op-request.md
and pasting the following:
Some of the operators in the model are not supported by the standard TensorFlow Lite runtime. If those are native TensorFlow operators, you might be able to use the extended runtime by passing --enable_select_tf_ops, or by setting target_ops=TFLITE_BUILTINS,SELECT_TF_OPS when calling tf.lite.TFLiteConverter(). Otherwise, if you have a custom implementation for them you can disable this error with --allow_custom_ops, or by setting allow_custom_ops=True when calling tf.lite.TFLiteConverter(). Here is a list of builtin operators you are using: ADD, EXP, FULLY_CONNECTED, LOGISTIC, MUL. Here is a list of operators for which you will need custom implementations: RandomStandardNormal.
Я знаю, что tf.lite.toco_convert запрещен, но яэто нужно для старых работ.Я думаю, что это связано со следующей строкой epsilon = K.random_normal(shape=(batch, dim))
return z_mean + K.exp(0.5 * z_log_var) * epsilon
.Я не уверен, почему это происходит, потому что старый tenorsflow keras.backend имеет атрибут random_normal
.Было бы полезно, если бы вы могли отлаживать или указывать на некоторые ресурсы, чтобы обойти эту ошибку.