Autotuning tutorial issue

Running the autotuning example, which I’ve downloaded as a standalone Python script, however I am having difficult getting it working.

First, the line from tvm import te fails with ImportError: cannot import name 'te' from 'tvm'. I’ve applied a fix by replacing it with import tvm as te.

However, the template decorator appears to have some issue, since it fails with the following error:

  File "example_autotune.py", line 55, in <module>
    @autotvm.template("tutorial/matmul_v1")  # 1. use a decorator

  File "/home/[redacted]/tools/tvm/python/tvm/autotvm/task/task.py", line 284, in template
    fname = get_func_name(func)

  File "/home/[redacted]/tools/tvm/python/tvm/autotvm/util.py", line 140, in get_func_name
    return func.func_name if hasattr(func, 'func_name') else func.__name__

AttributeError: 'str' object has no attribute '__name__'

Given these two issues, does this example include some depreciated features? Or does it only work inside the tvm tree somewhere?

import tvm as te is incorrect. te is a namespace in tvm. Could you check if your TVM version is up-to-date?

Ah yes. I’m running v0.6, which is not the version used on the site. Going to the tutorials/autotvm directory in my local tree has a version of the code that works, and I can see the differences between this and the newest version. Cheers!