mehrdadh commented on a change in pull request #9993:
URL: https://github.com/apache/tvm/pull/9993#discussion_r790995603



##########
File path: gallery/how_to/work_with_microtvm/micro_tflite.py
##########
@@ -190,8 +191,23 @@
 #  board but a couple of wirings and configs differ, it's necessary to select 
the "stm32f746g_disco"
 #  board to generated the right firmware image.
 #
-#  TARGET = tvm.target.target.micro("stm32f746xx")
-#  BOARD = "nucleo_f746zg" # or "stm32f746g_disco#"
+
+import json
+import pathlib
+
+if use_physical_hw:
+    if os.getenv("TVM_MICRO_BOARD"):
+        BOARD = os.getenv("TVM_MICRO_BOARD")
+        with open(
+            pathlib.Path(tvm.micro.get_microtvm_template_projects("zephyr")) / 
"boards.json"
+        ) as f:
+            board_properties = json.load(f)
+            boards_model = {board: info["model"] for board, info in 
board_properties.items()}

Review comment:
       @gromero thanks for the great suggestions! I added all. 

##########
File path: gallery/how_to/work_with_microtvm/micro_tflite.py
##########
@@ -123,12 +123,18 @@
 # directory into a buffer
 
 import os
+import json
+import tarfile
+import pathlib
+import tempfile
 import numpy as np
 
 import tvm
-from tvm.contrib.download import download_testdata
 from tvm import relay
+import tvm.contrib.utils
+from tvm.contrib.download import download_testdata
 
+use_physical_hw = True if os.getenv("TVM_MICRO_USE_HW") else False

Review comment:
       done!

##########
File path: gallery/how_to/work_with_microtvm/micro_tflite.py
##########
@@ -192,21 +197,13 @@
 #  board to generated the right firmware image.
 #
 
-import json
-import pathlib
+boards_file = pathlib.Path(tvm.micro.get_microtvm_template_projects("zephyr")) 
/ "boards.json"
+with open(boards_file) as f:
+    boards = json.load(f)
+
+BOARD = os.getenv("TVM_MICRO_BOARD", default="nucleo_f746zg")
+TARGET = tvm.target.target.micro(boards[BOARD]["model"])

Review comment:
       nope, that was incorrect. fixed it.
   Thanks!




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