relax icon indicating copy to clipboard operation
relax copied to clipboard

TVM script ir_module decorator returns an IRModule directly

Open altanh opened this issue 3 years ago • 0 comments

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.

altanh avatar Nov 03 '21 23:11 altanh