Mousius commented on code in PR #12789:
URL: https://github.com/apache/tvm/pull/12789#discussion_r1029766343


##########
python/tvm/micro/model_library_format.py:
##########
@@ -277,6 +301,32 @@ def _create_empty_entry(target_device_type):
             main_func_metadata.io_sizes[target]
         )
 
+        # Now, we also add the information about the size of each input and 
output of the main
+        # function (in bytes)
+        input_dict = {}
+        for input_param in main_func_metadata.relay_primfuncs[target].params:
+            input_dict[input_param.name_hint] = 
_create_type_metadata(input_param.checked_type)
+        target_main_entries[int(target.get_target_device_type())]["inputs"] = 
input_dict
+
+        output_dict = {}
+        # For output, we dont have the name of the output, so we enumerate them
+        if isinstance(main_func_metadata.relay_primfuncs[target].ret_type, 
tvm.ir.type.TupleType):
+            output_list = _convert_tuple_to_outputs(
+                main_func_metadata.relay_primfuncs[target].ret_type
+            )
+            for i, output_type in enumerate(output_list):
+                if hasattr(output_type, "shape"):
+                    output_dict[f"output{i}"] = 
_create_type_metadata(output_type)
+                else:
+                    output_dict[f"output{i}"] = {"size": 0, "dtype": ""}
+        else:
+            output_type = main_func_metadata.relay_primfuncs[target].ret_type
+            if hasattr(output_type, "shape"):
+                output_dict["output"] = _create_type_metadata(output_type)
+            else:
+                output_dict["output"] = {"size": 0, "dtype": ""}

Review Comment:
   Is there a case where this happens? I can't see it in the test cases



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