You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by "lhutton1 (via GitHub)" <gi...@apache.org> on 2023/05/11 09:27:19 UTC

[GitHub] [tvm] lhutton1 commented on a diff in pull request #14819: [TFLite][Frontend] Generate name when tensor name is missing

lhutton1 commented on code in PR #14819:
URL: https://github.com/apache/tvm/pull/14819#discussion_r1190843066


##########
python/tvm/relay/frontend/tflite.py:
##########
@@ -4116,7 +4116,12 @@ def get_tensor_name(subgraph, tensor_idx):
     -------
         tensor name in UTF-8 encoding
     """
-    return subgraph.Tensors(tensor_idx).Name().decode("utf-8")
+    tensor_name = subgraph.Tensors(tensor_idx).Name()
+    if tensor_name is not None:
+        tensor_name = tensor_name.decode("utf-8")
+    else:
+        tensor_name = "tvmgen_tensor_" + str(tensor_idx)

Review Comment:
   I don't have a strong opinion on the name, but just a thought - this name seems AOT specific, perhaps we could just use "placeholder_{i}" instead?



##########
python/tvm/relay/frontend/tflite.py:
##########
@@ -4150,7 +4155,8 @@ def _input_type(model):
             tensor = subgraph.Tensors(input_)
             input_shape = tuple(tensor.ShapeAsNumpy())
             tensor_type = tensor.Type()
-            input_name = tensor.Name().decode("utf8")
+            tensor_name = get_tensor_name(subgraph, input_)
+            input_name = tensor_name if isinstance(tensor_name, str) else tensor_name.decode("utf8")

Review Comment:
   Should the decoding already have happened in `get_tensor_name`?



-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org