[AutoTVM] run The official tutorial tune_relay_x86.py, print incredible error

I am seeing an issue when trying to run the Office Tutorials tune_relay_x86.py on Linux:

AttributeError: Schedule object has no attributed code_hash

It comes from this block of tvm/python/tvm/autotvm/task/task.py:

ctx = ApplyConfig(ret.config_space)
    with ctx:
        with target:
            sch, _ = func(*args)
            ret.config_space.code_hash = getattr(sch, 'code_hash', None)

It seems that getattr shouldn’t be throwing here, and the default value should be used. Why is it wrong?

Before this mistake,I find other mistakes.

Traceback (most recent call last):
   File "/tvm/python/tvm/relay/expr_functor.py", line 45, in visit
    res = self.visit_call(expr)
  File "/tvm/python/tvm/relay/memory_alloc.py", line 31, in is_primitive
    return hasattr(call.op, 'attrs') and hasattr(call.op.attrs, 'Primitive') and \

  File "/tvm/python/tvm/runtime/object.py", line 53, in __getattr__
    return _api_internal._NodeGetAttr(self, name)

  File "/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 213, in __call__
    raise get_last_ffi_error()
[bt](3) tvm/build/libtvm.so(std::_Function_handler<vioid (tvm::runtime::TVMArgs, tvm runtime....)
[bt](2) tvm/build/libtvm.so(tvm::NodeGetAttr(tvm::runtime::TVMArgs&&,...))
[bt](1) tvm/build/libtvm.so(tvm::ReflectionTable::GetAttr(tvm::runtime::object*,...))
[bt](0) tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal())
AttributeError: relay.op object has no attributed attrs

It comes from this block of tvm/python/tvm/relay/memory_alloc.py:

def is_primitive(call):
    return hasattr(call.op, 'attrs') and hasattr(call.op.attrs, 'Primitive') and \
        int(call.op.attrs.Primitive) == 1

If not ‘attrs’ ,should return False instead of error. Why not?