vdkhoi commented on code in PR #11183:
URL: https://github.com/apache/tvm/pull/11183#discussion_r867699105


##########
python/tvm/relay/frontend/tflite.py:
##########
@@ -2710,6 +2743,145 @@ def convert_unpack(self, op):
 
         return squeezed
 
+    def convert_unidirectional_sequence_lstm(self, op):
+        """Long Short Term Memory for TFLite implementation."""
+        if self.is_quantized(op):
+            raise tvm.error.OpNotImplemented(
+                "TFlite quantized UNIDIRECTIONALSEQUENCELSTM operator is not 
supported yet."
+            )
+
+        input_tensors = self.get_input_tensors(op)
+        assert len(input_tensors) >= 20, "input tensors length should be >= 20"
+
+        # Extract input tensor from saved model
+        input_tensor = input_tensors[0]
+
+        # Extract tensors from input tensors from saved model
+        # Input weights
+        input_input_weights = input_tensors[1]
+        input_forget_weights = input_tensors[2]
+        input_cell_weights = input_tensors[3]
+        input_output_weights = input_tensors[4]
+        # Recurrent weights
+        recurrent_input_weights = input_tensors[5]
+        recurrent_forget_weights = input_tensors[6]
+        recurrent_cell_weights = input_tensors[7]
+        recurrent_output_weights = input_tensors[8]
+        # Bias weights
+        input_gate_bias = input_tensors[12]
+        forget_gate_bias = input_tensors[13]
+        cell_gate_bias = input_tensors[14]
+        output_gate_bias = input_tensors[15]
+        # State input
+        output_state_in = input_tensors[18]
+        cell_state_in = input_tensors[19]

Review Comment:
   Thank you for your feedback. Yes. The maximum number of tensors that tflite 
can store in model is 24 tensors. Let's isolate two concepts of index: 
   - **array index** is the location of tensor in array _input_tensors_
   - **tensor_idx** is a property of each tensor, to indicate the location of 
the tensor in tflite model. You can find location values by opening Netron to 
look at
   
   Manipulation by the tflite tool, the value of array index and tensor_idx are 
different. What we are interested just tensor_idx. And the last meaningful 
value of tensor_idx in UnidirectionalSequenceLSTM is at array index 
(input_tensor[19]), which mean, this operator only utilize 20 first location to 
store its tensors.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to