Skip to content

Commit cac6ff8

Browse files
authored
[TOPI] Support integer type input for log10 (#18015)
* Update math.py * fix flint
1 parent 4289efa commit cac6ff8

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

python/tvm/topi/math.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,6 @@ def log2(x):
484484
return te.compute(x.shape, lambda *i: te.log2(x(*i)))
485485

486486

487-
@tvm.te.tag_scope(tag=tag.ELEMWISE)
488487
def log10(x):
489488
"""Take logarithm to the base 10 of input x.
490489
@@ -498,7 +497,9 @@ def log10(x):
498497
y : tvm.te.Tensor
499498
The result.
500499
"""
501-
return te.compute(x.shape, lambda *i: te.log10(x(*i)))
500+
if x.dtype.startswith("int"):
501+
x = te.compute(x.shape, lambda *i: x(*i).astype("float32"))
502+
return te.compute(x.shape, lambda *i: te.log10(x(*i)), tag=tag.ELEMWISE)
502503

503504

504505
@tvm.te.tag_scope(tag=tag.ELEMWISE)

0 commit comments

Comments
 (0)