You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2022/11/22 20:00:03 UTC

[GitHub] [tvm] Mousius commented on a diff in pull request #12789: Added macro generation in MLF export

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

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