gromero commented on a change in pull request #9229:
URL: https://github.com/apache/tvm/pull/9229#discussion_r738593504



##########
File path: python/tvm/driver/tvmc/runner.py
##########
@@ -384,13 +482,27 @@ def run_module(
         else:
             logger.debug("Running on remote RPC with no key.")
             session = rpc.connect(hostname, port)
+    elif device == "micro":
+        # Remote RPC (running on a micro target)
+        logger.debug("Running on remote RPC (micro target).")
+        try:
+            with ExitStack() as stack:

Review comment:
       oh got it. thanks, I misunderstood the purpose of `contextlib` the first 
time.
   
   So, I've put all below line 475 inside the `with` scope as you suggested.  
Just a note that was precisely something like that I was trying to avoid since 
the beginning, that's why I thought of introducing `open()` and `close()` 
methods at first then use them explicitly in `runner.py`, first when opening 
the transport and creating a session, than later at end of `run_module`, 
checking again if `device == "micro"`  and if so calling `close()` explicitly. 
But yeah If you think that putting everything after line 475 inside `with` is 
ok, alright then.




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