-
Notifications
You must be signed in to change notification settings - Fork 74.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Supporting control flow in TensorFlow Lite #28485
Comments
When we can expect control flow in TensorFlow Lite? |
Is this really hard to implement? Because to me it looks like a very critical issue and the lack of attention seems quite weird. How else am I supposed to deploy my model to a mobile device? Are there any workarounds? EDIT: I see that while op is registered here , can I somehow use it? |
I met the same problem. It shows that "switch and merge" operations which in batchnormalization(bn) are not supported. However, I change the is_training from tf.bool to tf.Variable. This process are OK and the tflite model are produced sucessfully. |
@jdduke Any updates on when the other control flow items will be available? Specifically Merge. |
@miaout17 any updates on this? It's been 6 months with no news |
Any updates? |
I had the same problem. Look forward to the update! |
I met the same problem |
I had the same issue. 2019-11-27 09:27:26.184856: F .\tensorflow/lite/toco/toco_tooling.h:38] Check failed: s.ok() Found StridedSlice as non-selected output from Switch, but only Merge supported. Control flow ops like Switch and Merge are not generally supported. We are working on fixing this, please see the Github issue at #28485. |
I had the same issue when I tried to convert SSDlite mobileNet to tflite. |
I met the same problem |
F ./tensorflow/lite/toco/toco_tooling.h:38] Check failed: s.ok() Found StridedSlice as non-selected output from Switch, but only Merge supported. Control flow ops like Switch and Merge are not generally supported. We are working on fixing this, please see the Github issue at #28485. |
I met the same problem. Look forward to the update. |
I used my converted tflite model for inference with the following code. |
Which model are you trying to convert? The Enter is a control flow v1 op, which tflite new converter doesn't support. Can you build the model with TF 2 so that it contains V2 style control flow? |
@haozha111 I am trying to convert EfficientDet in https://github.com/xuannianz/EfficientDet, which is based on fizyr/keras-retinanet in https://github.com/fizyr/keras-retinanet. Does TF 2 support enter, exit, switch and merge? |
Rather than making this thread longer, can you please open a new Github issue, and attach your current error messages, your original TF model and the reproduce steps there? That will help us better triage the issue. Thanks. |
I met the same problem. I am using a batch normalization layer (tf.layer.batch_normalization). 2020-01-22 15:33:09.575787: F ./tensorflow/lite/toco/toco_tooling.h:38] Check failed: s.ok() Found Mul as non-selected output from Switch, but only Merge supported. Control flow ops like Switch and Merge are not generally supported. We are working on fixing this, please see the Github issue at #28485. |
|
Hi! Then in tf 2.1 I use the following:
And the result is:
And if I check the tags with The results is: Another case, If I froze the model, with tensorflow.python.tools import freeze_graph in tf2.1, and save in "saved_model.pb". And convert with the same previous code I get:
|
any update? |
That's a bit surprising. How did you export your saved model? Could you use the saved_model_cli --show tool to dump an info about your saved model? I think by default there should be a serving graph inside it. |
Hi Haoliang! I follow your steps and other recomendations in the forums. But now I get an strange error:
The code that I use is: First, to pass from CheckPoint to SavedModel:
Second Step, Convert to Tensorflow Lite in 2.1 (or tf-nightly):
The error that I get is:
In this link I save the checkpoint if you want check it or repruduce the error. Also I write in starckoverflow about this error in the next link |
Hi I tried to convert my model in TF 1.15 into .tflite using the following:
However, I encountered the following error:
I'm not calling any DenseToDenseSetOperation explicitly. Is this part of the backend engine that is used to convert the tf functions into .tflite? |
@haozha111
|
when would control flow ops: Merge, Switch be supported |
Any Luck? |
I had the same problem. Looking forward to your update! |
In my case I removed tf.bool variable and upgrade TF from 1.12.0 to 1.14.0 both tflite_convert and load model works! |
With new converter now the default. TFLite should support Control Flow V2 ops. If you have problems, please file an issue with reproduce steps. Thanks |
I am trying to convert a Tensorflow model to TFLite as follows
but I still get the same error
Using Tensorflow 1.15 |
@e2r-htz You need to add this line "tf.enable_control_flow_v2()" not during converting but while creating/freezing your model. |
This is a tracking ticket for supporting generalized control flow in TensorFlow Lite. See also the RFC.
At this moment, if you see missing ops like "Switch", "Merge", "Enter", "Exit", "NextIteration" when converting a TensorFlow model to TensorFlow Lite, it means the graph contains control flows, and there's no way to convert it.
We're working hard to enable this feature. Updates will be posted here.
The text was updated successfully, but these errors were encountered: