From cb87c1e8ceb2feb3a150f82289d423c25cf739d1 Mon Sep 17 00:00:00 2001 From: Qingchao Shen Date: Mon, 26 May 2025 19:23:43 +0800 Subject: [PATCH 1/2] Update math.py --- python/tvm/topi/math.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/tvm/topi/math.py b/python/tvm/topi/math.py index 5e405cdf6b52..23525cf2e648 100644 --- a/python/tvm/topi/math.py +++ b/python/tvm/topi/math.py @@ -484,7 +484,6 @@ def log2(x): return te.compute(x.shape, lambda *i: te.log2(x(*i))) -@tvm.te.tag_scope(tag=tag.ELEMWISE) def log10(x): """Take logarithm to the base 10 of input x. @@ -498,7 +497,9 @@ def log10(x): y : tvm.te.Tensor The result. """ - return te.compute(x.shape, lambda *i: te.log10(x(*i))) + if x.dtype.startswith("int"): + x = te.compute(x.shape, lambda *i: x(*i).astype('float32')) + return te.compute(x.shape, lambda *i: te.log10(x(*i)), tag=tag.ELEMWISE) @tvm.te.tag_scope(tag=tag.ELEMWISE) From 81b91b0184e2805ba393e147b50b77d6eb9a5f67 Mon Sep 17 00:00:00 2001 From: Qingchao Shen Date: Mon, 26 May 2025 19:47:30 +0800 Subject: [PATCH 2/2] fix flint --- python/tvm/topi/math.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/tvm/topi/math.py b/python/tvm/topi/math.py index 23525cf2e648..fb306f9e599b 100644 --- a/python/tvm/topi/math.py +++ b/python/tvm/topi/math.py @@ -498,7 +498,7 @@ def log10(x): The result. """ if x.dtype.startswith("int"): - x = te.compute(x.shape, lambda *i: x(*i).astype('float32')) + x = te.compute(x.shape, lambda *i: x(*i).astype("float32")) return te.compute(x.shape, lambda *i: te.log10(x(*i)), tag=tag.ELEMWISE)