question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TF Select operators in tflite web runtime

See original GitHub issue

System information

  • TensorFlow.js version (you are using): 3.11.0
  • Are you willing to contribute it (Yes/No): Yes, willing to help where possible

Describe the feature and the current behavior/state. While attempting to convert a TF SavedModel to tflite for use on the web, I got this error:

Some ops are not supported by the native TFLite runtime, you can enable TF kernels fallback using TF Select. See instructions: https://www.tensorflow.org/lite/guide/ops_select 
TF Select ops: AddV2, ArgMax, BatchMatMulV2, Cast, GatherV2, MatMul, Mul, Range, RealDiv, Sigmoid, Softmax, StridedSlice, Transpose

And for another model, these were the missing ops:

AddV2, BatchMatMulV2, Cast, ConcatV2, Conv2D, Fill, GatherV2, MatMul, Mul, RealDiv, Sigmoid, Softmax, StridedSlice, Transpose

The linked docs don’t show how to run inference with the tflite web runtime (only Android, iOS, C++ and Python). I take this to imply that it’s not currently possible to use the extended set of ops with the tflite web runtime.

Will this change the current api? How? Unsure if this will be an API change or a build step in the tflite web runtime.

Who will benefit with this feature? Presumably the “Select TensorFlow operators” feature exists on other platforms due to developer demand. Web developers like myself would get the same benefits as developers on the other platforms.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jinjingforevercommented, Feb 23, 2022

Thank you so much for your insights on this @josephrocca! I agree with your points, especially about “strong fallback”.

I will take a closer look on this issue (focusing on the TF select ops) and see what I can find. (sorry, I am not exact sure the timeline, but this seems to be pretty useful thing to do so I will try to prioritize). Will also discuss this with my team.

Really appreciate it!

0reactions
josephroccacommented, Jul 6, 2022

No problem, thanks for the update!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Select TensorFlow operators | TensorFlow Lite
The following example shows how to generate a TensorFlow Lite model with select TensorFlow ops. ... tf.lite.OpsSet.TFLITE_BUILTINS, # enable ...
Read more >
AN13699 - NXP
Some operators are not supported by the native TFLite runtime, but you can enable the TF kernels fallback using TF Select.
Read more >
Custom Operator Conversion for TFLite 2.2 - Google Groups
The converter registers a new Op to the TF ops as if you defined a new Op in TF, so it can load...
Read more >
How can I throw a runtime error in TFLite? - Stack Overflow
The ReportError method is used to report runtime errors in a TFLite model. It's primarily intended for platform-specific error reporting (e.g. ...
Read more >
Quantize ONNX Models | onnxruntime
ONNX quantization representation format · Operator-oriented (QOperator). All the quantized operators have their own ONNX definitions, like QLinearConv, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found