margelo / margelo/react-native-fast-tflite
How to run inference with dynamic shape model ?
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 92
- Avg merge
- 13h 9m
- Merged PRs (30d)
- 2
Description
Hi bro,
I have a model that supports dynamic shape, but tflite does not support it when converting, but it does support it from the code.
Doc from TFL
https://www.tensorflow.org/lite/guide/inference#run_inference_with_dynamic_shape_model
If you want to run a model with dynamic input shape, resize the input shape before running inference. Otherwise, the None shape in Tensorflow models will be replaced by a placeholder of 1 in TFLite models.
The following examples show how to resize the input shape before running inference in different languages. All the examples assume that the input shape is defined as [1/None, 10], and need to be resized to [3, 10].
// Resize input tensors before allocate tensors
interpreter->ResizeInputTensor(/*tensor_index=*/0, std::vector<int>{3,10});
interpreter->AllocateTensors();
How to operate with react-native-fast-tflite
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked TensorFlow Lite dynamic-shape inference documentation and the react-native-fast-tflite usage entry points. Determine whether the exposed API supports resizing the input before tensor allocation, and document the supported steps or limitations with a working example; the answer should be verifiable by running dynamic-shape inference.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, tensorflow
- Domain
- machine-learning, mobile
- Issue type
- Documentation
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100