comaniac commented on a change in pull request #6842:
URL: https://github.com/apache/incubator-tvm/pull/6842#discussion_r519199787
##########
File path: python/tvm/auto_scheduler/compute_dag.py
##########
@@ -182,3 +187,11 @@ def hash_key(self):
str_key = str_key.encode(encoding="utf-8")
return hashlib.md5(str_key).hexdigest()
+
+ def __getstate__(self):
+ return {"compute": SaveJSON(self.compute), "sche": SaveJSON(self.sche)}
+
+ def __setstate__(self, state):
+ self.compute = LoadJSON(state["compute"]) # pylint:
disable=assignment-from-no-return
Review comment:
We don't call them in SearchTask because all its members have
__setstate__ and __getstate__ implemented correctly. This function provides the
correct implementation for ConouteDAG and it will be called When processing
ComputeDAG in SearchTask.
For Load/SaveJSON here, alternatively we can use pickle.loads/dumps and let
them call Load/SaveJSON via Objects. However, this will introduce the
dependency of pickle in this function, and will somehow trigger a bug in the
unit test. You can test it by replacing Load/SaveJSON with pickle calls. In the
unit test I add, you will find that after loading the DAG back, the placeholder
A appears twice.
----------------------------------------------------------------
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]