leandron commented on a change in pull request #7400:
URL: https://github.com/apache/tvm/pull/7400#discussion_r573275644



##########
File path: python/tvm/relay/frontend/tflite.py
##########
@@ -3539,7 +3539,62 @@ def get_tensor_name(subgraph, tensor_idx):
     return subgraph.Tensors(tensor_idx).Name().decode("utf-8")
 
 
-def from_tflite(model, shape_dict, dtype_dict):
+def get_tensor_shape(subgraph, tensor_idx):
+    """Get the tensor shape.

Review comment:
       * minor: the name of the argument doesn't match with the actual argument
   * the types are not specified
   
   Please review all docstring being introduced here for those items above.

##########
File path: python/tvm/relay/frontend/tflite.py
##########
@@ -3588,8 +3643,14 @@ def from_tflite(model, shape_dict, dtype_dict):
     exp_tab = ExprTable()
     for model_input in model_inputs:
         model_input_name = get_tensor_name(subgraph, model_input)
-        shape = shape_dict[model_input_name] if model_input_name in shape_dict 
else None
-        dtype = dtype_dict[model_input_name] if model_input_name in dtype_dict 
else "float32"
+        if shape_dict:
+            shape = shape_dict[model_input_name] if model_input_name in 
shape_dict else None
+        else:
+            shape = get_tensor_shape(subgraph, model_input)
+        if dtype_dict:
+            dtype = dtype_dict[model_input_name] if model_input_name in 
dtype_dict else "float32"
+        else:
+            dtype = get_tensor_type(subgraph, model_input)

Review comment:
       We have a similar function, that collect the same information being 
proposed here in TVMC. I agree we should move what is in there, to unify 
functionality here.
   
   Can you have a look on the function I'm pointing here (below) and spot why 
are they so different, and in case you agree on what's the best approach, 
improve it here and remove it there?
   
   
https://github.com/apache/tvm/blob/2999d03284c74f6840503ae3b880d3579a76f1af/python/tvm/driver/tvmc/frontends.py#L255-L278
   
   




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

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


Reply via email to