Compute_inline fails

import tvm
import topi

n = tvm.var("n")
A = tvm.placeholder((n,1), name='A')
result2 = topi.nn.relu(A)
result3 = topi.nn.leaky_relu(result2, 0.3)
s = tvm.create_schedule(result3.op)
s[result3].compute_inline()
print(tvm.lower(s, [A, result3], simple_mode=True))

I tried simple compute_inline in tvm docker, but I got this:

---------------------------------------------------------------------------
TVMError                                  Traceback (most recent call last)
<ipython-input-44-4f32becaea58> in <module>()
      8 s = tvm.create_schedule(result3.op)
      9 s[result3].compute_inline()
---> 10 print(tvm.lower(s, [A, result3], simple_mode=True))

/usr/tvm/python/tvm/build_module.py in lower(sch, args, name, binds, simple_mode)
    338         # normalize schedule first
    339         sch = sch.normalize()
--> 340         bounds = schedule.InferBound(sch)
    341         stmt = schedule.ScheduleOps(sch, bounds)
    342         stmt = ir_pass.InjectPrefetch(stmt)

/usr/tvm/python/tvm/_ffi/function.py in my_api_func(*args)
    278         The result of the API function call.
    279         """
--> 280         return flocal(*args)
    281     return my_api_func
    282 

/usr/tvm/python/tvm/_ffi/_ctypes/function.py in __call__(self, *args)
    182         check_call(_LIB.TVMFuncCall(
    183             self.handle, values, tcodes, ctypes.c_int(num_args),
--> 184             ctypes.byref(ret_val), ctypes.byref(ret_tcode)))
    185         _ = temp_args
    186         _ = args

/usr/tvm/python/tvm/_ffi/base.py in check_call(ret)
     64     """
     65     if ret != 0:
---> 66         raise TVMError(py_str(_LIB.TVMGetLastError()))
     67 
     68 

TVMError: [03:19:57] /usr/tvm/src/schedule/bound.cc:135: Check failed: it != rmap->end() 

Stack trace returned 10 entries:
[bt] (0) /usr/tvm/build/libtvm.so(dmlc::StackTrace[abi:cxx11]()+0x1bc) [0x7ff31f15f14c]
[bt] (1) /usr/tvm/build/libtvm.so(dmlc::LogMessageFatal::~LogMessageFatal()+0x28) [0x7ff31f15fd28]
[bt] (2) /usr/tvm/build/libtvm.so(tvm::schedule::InferRootBound(tvm::Stage const&, tvm::schedule::GraphContext const&, std::unordered_map<tvm::IterVar, tvm::Range, std::hash<tvm::IterVar>, std::equal_to<tvm::IterVar>, std::allocator<std::pair<tvm::IterVar const, tvm::Range> > >*)+0xf92) [0x7ff31f37d142]
[bt] (3) /usr/tvm/build/libtvm.so(tvm::schedule::InferBound(tvm::Schedule const&)+0xecb) [0x7ff31f37f48b]
[bt] (4) /usr/tvm/build/libtvm.so(+0x1ea218) [0x7ff31f162218]
[bt] (5) /usr/tvm/build/libtvm.so(TVMFuncCall+0x5e) [0x7ff31f56b6ce]
[bt] (6) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call_unix64+0x4c) [0x7ff39081ce20]
[bt] (7) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(ffi_call+0x2eb) [0x7ff39081c88b]
[bt] (8) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(_ctypes_callproc+0x49a) [0x7ff39081701a]
[bt] (9) /usr/lib/python3.5/lib-dynload/_ctypes.cpython-35m-x86_64-linux-gnu.so(+0x9fcb) [0x7ff39080afcb]

Help! Thanks!

you should do compute_inline on result2, not result3.

1 Like