merrymercy opened a new pull request #6660:
URL: https://github.com/apache/incubator-tvm/pull/6660


   To avoid the confusion in #6570, we call `del measure_ctx` earlier in the 
tutorial, just after we finish the search.
   
   `measure_ctx` overloads the `__del__`. Ideally, we do not need to call `del 
measure_ctx` explicitly.
   However, I found `__del__` only works for local variables.
   If we use `measure_ctx` as a local variable inside a function, it can be 
garbage-collected correctly.
   But in the tutorial, which is a single script, the `measure_ctx` is a global 
varaible. Then it cannot be garbage-collected correctly.
   
   There are two ways to solve this problem.
   **S1**. call `del measure_ctx` explicitly
   **S2**. use 
   ```
   with measure_ctx:
     tune_options = ...
     s, args = auto_scheduler.auto_schedule(...)
   ```
   
   I vote for **S1**. In **S1**, `del measure_ctx` is only required if 
`measure_ctx` is a global varaible, which is a rare case.
   


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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to