You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With halide-19.0.0.dev36, a numpy.float32(1.2) as an argument to halide.Expr's constructor will give a resulting Expr of type hl.Bool():
>>> hl.Expr(np.float32(4.5))
<halide.Expr of type bool: (uint1)1>
Earlier versions like halide 13 also give unexpected results: <halide.Expr of type int32: 4>.
I'm not sure if this is an unintended use case or unintended behavior.
I initially discovered it because np.float32(np.pi) was part of a calculation and it ended up being treated as an integer, giving wrong results.
I would be greatful if you have any ideas to fix or avoid this type of behavior.
(Short term, we are keeping away from numpy.float32)
Here is a minimal example/test:
import halide as hl
import numpy as np
assert (hl.Expr(np.float32(1.2))).type() == hl.Float(32) # Error, currently gives hl.Bool() (or hl.Int(32))