Closed tonyjie closed 4 years ago
This is similar to #122, where the first argument should be a HeteroCL/TVM expression. I can do a quick fix.
Should be fixed by #135. Let me know otherwise.
The function `hcl.select(cond, true, false)' itself works well now. But I still have problems when I try to use this function as a part of index. It can be reproduced as follows.
import heterocl as hcl
hcl.init()
extent = 2
def top(input, ):
blur_x = hcl.compute((640, (480 + 2)), lambda x, y: 0, name = "blur_x", dtype = hcl.UInt(bits = 16))
blur_x[hcl.select(2 > 1, 0, 1), 0] = 2
return blur_x
input = hcl.placeholder((648, 482, ), name = "input", dtype = hcl.UInt(bits = 16))
s = hcl.create_schedule([input, ], top)
print(hcl.lower(s))
f = hcl.build(s)
The error message is:
(...........)
return _make.Select(condition, true_value, _make.Cast(true_value.dtype, false_value))
AttributeError: 'int' object has no attribute 'dtype'
Could you please solve this as well? Thanks!
Please check #136. Also, you need to wrap your tensor assignment with a HeteroCL stage.
Thanks. I think the problem is fixed now.
I'm using
hcl.select(cond, true, false)
function, and just encounter a problem. When comparing two definite number, e.g. 10 > 1, the result is suppose to be a bool, buthcl.select()
function doesn't think so...... It can be reproduced as follows:The error message is:
If I change the
cond
inhcl.select
from a definite number10
to a variabley
. Namely,hcl.select(y > 1, 10, 1)
, it works. But I think based on Python syntax, the result of a comparison operation should bebool
type, right?