Can't load TFLite output_details for quantizer model (encode)
- Dominant language
- C++
- Stars
- 4k
- Forks
- 368
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm not sure if I'm using it correctly, so could be that the problem is on my side. Consider the following code:
```python
!git clone --branch v1.3.2 https://github.com/google/lyra.git
import tensorflow as tf
quantizer = tf.lite.Interpreter("lyra/lyra/model_coeffs/quantizer.tflite")
quantizer.allocate_tensors()
print(quantizer.get_signature_runner("decode").get_input_details()) # works
print(quantizer.get_signature_runner("decode").get_output_details()) # works
print(quantizer.get_signature_runner("encode").get_input_details()) # works
print(quantizer.get_signature_runner("encode").get_output_details()) # ERROR: ValueError: Invalid tensor index 703 exceeds max tensor index 422
```
The last line produces the following error:
```
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
[](https://localhost:8080/#) in
4 print(quantizer.get_signature_runner("decode").get_output_details())
5 print(quantizer.get_signature_runner("encode").get_input_details())
----> 6 print(quantizer.get_signature_runner("encode").get_output_details())
1 frames
[/usr/local/lib/python3.8/dist-packages/tensorflow/lite/python/interpreter.py](https://localhost:8080/#) in _get_tensor_details(self, tensor_index)
591 tensor_index = int(tensor_index)
592 tensor_name = self._interpreter.TensorName(tensor_index)
--> 593 tensor_size = self._interpreter.TensorSize(tensor_index)
594 tensor_size_signature = self._interpreter.TensorSizeSignature(tensor_index)
595 tensor_type = self._interpreter.TensorType(tensor_index)
ValueError: Invalid tensor index 703 exceeds max tensor index 422
```
I'm not really sure why...
Is that the proper way to use? Any TFLite example code that I can follow?
Thanks,
Zach
Contributor guide
Assessment
This issue has not been assessed yet.