Originally we do not support return statements inside compute APIs with multiple dimensions. The reason is that the indices of the tensors will be cast automatically, which results in incorrect behaviors in LLVM/CPU execution. Now the indices are unchanged. Following is a runnable example.
A = hcl.placeholder(10, 10, 10)
def compute(val):
with hcl.if_(val > 0):
hcl.return_(val)
with hcl.else_():
hcl.return_(0)
B = hcl.compute(A.shape, lambda *args: compute(A[args]))
Originally we do not support return statements inside compute APIs with multiple dimensions. The reason is that the indices of the tensors will be cast automatically, which results in incorrect behaviors in LLVM/CPU execution. Now the indices are unchanged. Following is a runnable example.
This is also added as a test case.