relax
relax copied to clipboard
TVM script ir_module decorator returns an IRModule directly
When decorating a python class with the ir_module
decorator, the result is the parsed IRModule, which is a slight mismatch with python semantics. We expect the class identifier to be a constructor that returns an instance of the class, so similarly it would be more familiar to have
@tvm.script.ir_module
class MyModule:
...
mod = MyModule()
instead of mod = MyModule
. A simple solution would be to return a thunk lambda: parsed_mod
.