Aharrypotter commented on code in PR #19813:
URL: https://github.com/apache/tvm/pull/19813#discussion_r3427175295


##########
python/tvm/relax/frontend/tflite/tflite_frontend.py:
##########
@@ -1521,6 +1534,18 @@ def get_scalar_value(tensor):
 
         return out
 
+    def convert_rank(self, op):
+        """Convert TFLite RANK."""
+        input_tensors = self.get_input_tensors(op)
+        assert len(input_tensors) == 1, "input tensors length should be 1"
+
+        output_tensors = self.get_output_tensors(op)
+        assert len(output_tensors) == 1, "output tensors length should be 1"
+        output_dtype = 
self.get_tensor_type_str(output_tensors[0].tensor.Type())
+
+        rank = len(self.get_tensor_shape(input_tensors[0]))
+        return relax.const(np.array(rank, dtype=output_dtype), 
dtype=output_dtype)

Review Comment:
   Addressed by returning `relax.const(rank, dtype=output_dtype)`.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to