This example fails with float32 (but it works with float64):
import iarray as ia
from iarray.expr_udf import expr_udf
import numpy as np
ia.set_config_defaults(dtype=np.float32)
a = ia.arange([10, 10])
b = ia.arange([10, 10])
# Syntactic sugar on where()
expr = expr_udf(
'a[b > 5 and not a < 8 or b > 42]',
{'a': a, 'b': b},
debug=1,
)
out = expr.eval()
print(out.data)
with:
/Users/faltet/miniconda3/envs/iron-array-python/bin/python /Users/faltet/iarray/iron-array-python/examples/expr_udf_float32.py
def f(out:
udf.Array(udf.float32, 2), a:
udf.Array(udf.float32, 2), b:
udf.Array(udf.float32, 2)):
for i0 in range(out.shape[0]):
for i1 in range(out.shape[1]):
out[i0, i1] = a[i0, i1] if b[i0, i1] > 5 and (not a[i0, i1] < 8) or b[i0, i1] > 42 else (1e309-1e309)
return 0
Traceback (most recent call last):
File "/Users/faltet/iarray/iron-array-python/examples/expr_udf_float32.py", line 13, in <module>
expr = expr_udf(
File "/Users/faltet/iarray/iron-array-python/iarray/expr_udf.py", line 209, in expr_udf
udf_func = udf.jit(py_func, ast=tree, debug=debug)
File "/Users/faltet/iarray/iron-array-python/iarray/udf.py", line 234, in jit
return super().jit(*args, **kwargs)
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 1327, in jit
function.compile(node=ast, debug=debug)
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 1253, in compile
GenVisitor(debug).traverse(node)
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 232, in traverse
value = [self.traverse(x, node) for x in field if isinstance(x, ast.AST)]
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 232, in <listcomp>
value = [self.traverse(x, node) for x in field if isinstance(x, ast.AST)]
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 232, in traverse
value = [self.traverse(x, node) for x in field if isinstance(x, ast.AST)]
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 232, in <listcomp>
value = [self.traverse(x, node) for x in field if isinstance(x, ast.AST)]
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 232, in traverse
value = [self.traverse(x, node) for x in field if isinstance(x, ast.AST)]
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 232, in <listcomp>
value = [self.traverse(x, node) for x in field if isinstance(x, ast.AST)]
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 232, in traverse
value = [self.traverse(x, node) for x in field if isinstance(x, ast.AST)]
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 232, in <listcomp>
value = [self.traverse(x, node) for x in field if isinstance(x, ast.AST)]
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 234, in traverse
value = self.traverse(field, node)
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 243, in traverse
return self.callback("exit", node, parent, *args)
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 253, in callback
value = cb(node, parent, *args) if cb is not None else None
File "/Users/faltet/iarray/iron-array-python/iarray/py2llvm/py2llvm.py", line 767, in IfExp_exit
assert ltype is rtype
AssertionError
Process finished with exit code 1
This example fails with float32 (but it works with float64):
with: