tvm: Cannot match type float64 vs float32
my code :
ndim = 3
dtype = 'float64'
out_grad = tvm.placeholder([tvm.var() for _ in range(ndim)], name='out_grad', dtype=dtype)
out_data = tvm.placeholder([tvm.var() for _ in range(ndim)], name='out_data', dtype=dtype)
in_grad = tvm.compute([tvm.var() for _ in range(ndim)],
lambda *index: (out_grad[index] * out_data[index] * np.log(3, dtype=dtype)), name='in_grad')
s = tvm.create_schedule(in_grad.op)
print(tvm.lower(s, [in_grad, out_data, out_grad], simple_mode=True))
print(in_grad.dtype)
the error is : Traceback (most recent call last):
File "/Users/sguangyo/PycharmProjects/sgy/test.py", line 72, in <module>
lambda *index: (out_grad[index] * out_data[index] * np.log(3, dtype=dtype)), name='in_grad')
File "/Users/sguangyo/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-macosx-10.7-x86_64.egg/tvm/api.py", line 309, in compute
body = fcompute(*[v.var for v in dim_var])
File "/Users/sguangyo/PycharmProjects/sgy/test.py", line 72, in <lambda>
lambda *index: (out_grad[index] * out_data[index] * np.log(3, dtype=dtype)), name='in_grad')
File "/Users/sguangyo/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-macosx-10.7-x86_64.egg/tvm/expr.py", line 55, in __mul__
return _generic.multiply(self, other)
File "/Users/sguangyo/.local/lib/python3.7/site-packages/topi-0.6.dev0-py3.7.egg/topi/generic_op_impl.py", line 83, in _tensor_bop_impl
return orig_bop(lhs, rhs)
File "/Users/sguangyo/.local/lib/python3.7/site-packages/tvm-0.6.dev0-py3.7-macosx-10.7-x86_64.egg/tvm/generic.py", line 79, in multiply
return _make._OpMul(lhs, rhs)
File "tvm/_ffi/_cython/./function.pxi", line 310, in tvm._ffi._cy3.core.FunctionBase.__call__
File "tvm/_ffi/_cython/./function.pxi", line 245, in tvm._ffi._cy3.core.FuncCall
File "tvm/_ffi/_cython/./function.pxi", line 234, in tvm._ffi._cy3.core.FuncCall3
File "tvm/_ffi/_cython/./base.pxi", line 170, in tvm._ffi._cy3.core.CALL
tvm._ffi.base.TVMError: Traceback (most recent call last):
[bt] (4) 5 libtvm.dylib 0x0000000112e6e6b8 TVMFuncCall + 72
[bt] (3) 4 libtvm.dylib 0x0000000112649c91 std::__1::__function::__func<void tvm::runtime::TypedPackedFunc<HalideIR::Expr (HalideIR::Expr, HalideIR::Expr)>::AssignTypedLambda<tvm::ir::$_8>(tvm::ir::$_8)::'lambda'(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*), std::__1::allocator<void tvm::runtime::TypedPackedFunc<HalideIR::Expr (HalideIR::Expr, HalideIR::Expr)>::AssignTypedLambda<tvm::ir::$_8>(tvm::ir::$_8)::'lambda'(tvm::runtime::TVMArgs const&, tvm::runtime::TVMRetValue*)>, void (tvm::runtime::TVMArgs, tvm::runtime::TVMRetValue*)>::operator()(tvm::runtime::TVMArgs&&, tvm::runtime::TVMRetValue*&&) + 129
[bt] (2) 3 libtvm.dylib 0x00000001127cee81 tvm::operator*(HalideIR::Expr, HalideIR::Expr) + 33
[bt] (1) 2 libtvm.dylib 0x00000001127cd411 tvm::BinaryOpMatchTypes(HalideIR::Expr&, HalideIR::Expr&) + 1777
[bt] (0) 1 libtvm.dylib 0x0000000112629329 dmlc::LogMessageFatal::~LogMessageFatal() + 57
File "/Users/sguangyo/tvm/src/lang/expr_operator.cc", line 78
TVMError: Cannot match type float64 vs float32
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (9 by maintainers)
It doesn’t explain the overuse of np.log given math.log exists…
Why do you mix
np.logwith tvm IR building…given that we havemath.log