Skip to content

Commit

Permalink
[TEST] Fix testcase to make them more compatible to zero-rank (#3612)
Browse files Browse the repository at this point in the history
  • Loading branch information
tqchen authored Jul 24, 2019
1 parent 814554e commit 90eee08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions tests/python/unittest/test_codegen_llvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
# specific language governing permissions and limitations
# under the License.
import tvm
import topi
from tvm.contrib import util, clang
import numpy as np
import ctypes
Expand Down Expand Up @@ -349,8 +350,8 @@ def check_llvm(n):
A = tvm.placeholder((n, ), name='A')
scale = tvm.placeholder((), name='scale')
k = tvm.reduce_axis((0, n), name="k")
C = tvm.compute((), lambda : tvm.sum(A[k] * scale, axis=k), name="C")
D = tvm.compute((), lambda : C + 1)
C = tvm.compute((), lambda : tvm.sum(A[k] * scale(), axis=k), name="C")
D = tvm.compute((), lambda : C() + 1)
s = tvm.create_schedule(D.op)
# build and invoke the kernel.
f = tvm.build(s, [A, scale, D], "llvm")
Expand All @@ -373,8 +374,8 @@ def check_llvm(n):
A = tvm.placeholder((n, ), name='A')
scale = tvm.placeholder((), name='scale')
k = tvm.reduce_axis((0, n), name="k")
C = tvm.compute((), lambda : tvm.sum(A[k] * scale, axis=k), name="C")
D = tvm.compute((), lambda : C + 1)
C = tvm.compute((), lambda : tvm.sum(A[k] * scale(), axis=k), name="C")
D = tvm.compute((), lambda : C() + 1)
s = tvm.create_schedule(D.op)
# build and invoke the kernel.
f = tvm.build(s, [A, scale, D], "llvm")
Expand Down
2 changes: 2 additions & 0 deletions topi/python/topi/generic_op_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ def _tensor_bop_impl(lhs, rhs):
tvm.Expr (otherwise)
The result of {op} operation.
"""
print(lhs, type(lhs))
print(rhs, type(rhs))
if not isinstance(lhs, tvm.tensor.Tensor) and not isinstance(rhs, tvm.tensor.Tensor):
return orig_bop(lhs, rhs)
return broadcast_bop(lhs, rhs)
Expand Down

0 comments on commit 90eee08

Please sign in to comment.