comaniac commented on pull request #5703: URL: https://github.com/apache/incubator-tvm/pull/5703#issuecomment-637038571
Ah, this is a bit tricky. For type annotation, we should use `DFPattern` in this case. However, in Python 3.6, it parses the source file only once for type checking. It means if we define a class and refer it in the same file, the type checking won't find that class and will report type errors. While this issue has been fixed in Python 3.7, an official workaround is using a string for the class type. You can see https://stackoverflow.com/questions/15853469/putting-current-class-as-return-type-annotation for details. Since TVM hasn't officially required Python 3.7+, I'd make sure the type annotation we are using is Python 3.6 compatible. ---------------------------------------------------------------- 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: us...@infra.apache.org