Hi experts. I’m trying to implement relu6 using TVM.
x = 100
a = te.placeholder((x,), name="a")
C = topi.clip(a, 0., 6.)
ts = te.create_schedule(C.op)
print(tvm.lower(ts, [C], simple_mode=True))
But the above code implementation reports an error
Traceback (most recent call last):
File "relu6.py", line 17, in <module>
print(tvm.lower(ts, [C], simple_mode=True))
File "/home/wangbiao/gitworks/tvm/python/tvm/driver/build_module.py", line 133, in lower
return ffi.lower_schedule(inp, args, name, binds, simple_mode)
File "/home/wangbiao/gitworks/tvm/python/tvm/_ffi/_ctypes/packed_func.py", line 237, in __call__
raise get_last_ffi_error()
tvm._ffi.base.TVMError: Traceback (most recent call last):
26: TVMFuncCall
25: _ZN3tvm7runtime13PackedFun
24: tvm::runtime::TypedPackedFunc<tvm::IRModule (tvm::te::Schedule, tvm::runtime::Array<tvm::runtime::ObjectRef, void> const&, tvm::runtime::String const&, tvm::runtime::Map<tvm::te::Tensor, tvm::tir::Buffer, void, void> const&, bool)>::AssignTypedLambda<tvm::{lambda(tvm::te::Schedule, tvm::runtime::Array<tvm::runtime::ObjectRef, void> const&, tvm::runtime::String const&, tvm::runtime::Map<tvm::te::Tensor, tvm::tir::Buffer, void, void> const&, bool)#5}>(tvm::{lambda(tvm::te::Schedule, tvm::runtime::Array<tvm::runtime::ObjectRef, void> const&, tvm::runtime::String const&, tvm::runtime::Map<tvm::te::Tensor, tvm::tir::Buffer, void, void> const&, bool)#5}, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)::{lambda(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)#1}::operator()(tvm::runtime::TVMArgs const, tvm::runtime::TVMRetValue) const
23: tvm::LowerSchedule(tvm::te::Schedule, tvm::runtime::Array<tvm::runtime::ObjectRef, void> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unordered_map<tvm::te::Tensor, tvm::tir::Buffer, std::hash<tvm::te::Tensor>, std::equal_to<tvm::te::Tensor>, std::allocator<std::pair<tvm::te::Tensor const, tvm::tir::Buffer> > > const&, bool)
22: tvm::ScheduleToModule(tvm::te::Schedule, tvm::runtime::Array<tvm::runtime::ObjectRef, void> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::unordered_map<tvm::te::Tensor, tvm::tir::Buffer, std::hash<tvm::te::Tensor>, std::equal_to<tvm::te::Tensor>, std::allocator<std::pair<tvm::te::Tensor const, tvm::tir::Buffer> > > const&)
21: tvm::te::SchedulePostProcToPrimFunc(tvm::runtime::Array<tvm::runtime::ObjectRef, void>, tvm::tir::Stmt, tvm::runtime::Optional<tvm::runtime::Map<tvm::te::Tensor, tvm::tir::Buffer, void, void> >)
20: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
19: _ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7r
18: tvm::te::TensorToBufferMapper::VisitStmt_(tvm::tir::ProducerRealizeNode const*)
17: tvm::tir::StmtMutator::VisitStmt_(tvm::tir::ProducerRealizeNode const*)
16: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
15: _ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7r
14: tvm::tir::StmtMutator::VisitStmt_(tvm::tir::ForNode const*)
13: tvm::tir::StmtMutator::VisitStmt(tvm::tir::Stmt const&)
12: _ZZN3tvm3tir11StmtFunctorIFNS0_4StmtERKS2_EE10InitVTableEvENUlRKNS_7r
11: tvm::te::TensorToBufferMapper::VisitStmt_(tvm::tir::ProducerStoreNode const*)
10: tvm::tir::StmtMutator::VisitStmt_(tvm::tir::ProducerStoreNode const*)
9: tvm::tir::StmtExprMutator::VisitExpr(tvm::PrimExpr const&)
8: _ZZN3tvm3tir11ExprFunctorIFNS_8PrimExprERKS2_EE10InitVTableEvENUlRKNS_7r
7: tvm::tir::ExprMutator::VisitExpr_(tvm::tir::MaxNode const*)
6: non-virtual thunk to tvm::tir::StmtExprMutator::VisitExpr(tvm::PrimExpr const&)
5: _ZZN3tvm3tir11ExprFunctorIFNS_8PrimExprERKS2_EE10InitVTableEvENUlRKNS_7r
4: tvm::tir::ExprMutator::VisitExpr_(tvm::tir::MinNode const*)
3: non-virtual thunk to tvm::tir::StmtExprMutator::VisitExpr(tvm::PrimExpr const&)
2: _ZZN3tvm3tir11ExprFunctorIFNS_8PrimExprERKS2_EE10InitVTableEvENUlRKNS
1: tvm::te::TensorToBufferMapper::VisitExpr_(tvm::tir::ProducerLoadNode const*)
0: tvm::te::TensorToBufferMapper::GetBuffer(tvm::te::Tensor const&, tvm::runtime::String, bool)
File "../src/te/schedule/schedule_postproc_to_primfunc.cc", line 143
TVMError:
---------------------------------------------------------------
An error occurred during the execution of TVM.
For more information, please see: https://tvm.apache.org/docs/errors.html
---------------------------------------------------------------
Check failed: (allow_alloc) is false: Cannot find the Realization point of tensor Tensor(shape=[100], op.name=a)