I have a .tflite, then I want to print Layer 22, but it can't work, it displays the error, I don't know how to fix.
My code
import tensorflow as tf
interpreter = tf.lite.Interpreter(model_path='/content/drive/MyDrive/non_RR/tflite_qaware_model.tflite')
interpreter.allocate_tensors()
print(interpreter.get_tensor(22))
The output
ValueError Traceback (most recent call last)
<ipython-input-63-d40b7ea1229d> in <cell line: 6>()
4 interpreter.allocate_tensors()
5
----> 6 print(interpreter.get_tensor(22))
/usr/local/lib/python3.10/dist-packages/tensorflow/lite/python/interpreter.py in get_tensor(self, tensor_index, subgraph_index)
874 a numpy array.
875 """
--> 876 return self._interpreter.GetTensor(tensor_index, subgraph_index)
877
878 def tensor(self, tensor_index):
ValueError: Tensor data is null. Run allocate_tensors() first