Numpy bool arrays don't work with Pythran backend
It doesn't seem to be possible to pass a bool array to a jit-compiled function with the Pythran backend. I didn't try with other backends. Here's an example:
import numpy as np
from transonic import jit, Array, wait_for_all_extensions, typeof
@jit
def test1(a: Array[bool, "2d"]):
return np.any(a)
@jit
def test2(a: Array[np.bool_, "2d"]):
return np.any(a)
a=np.zeros((3, 3), dtype=bool)
print(typeof(a).dtype) # <class 'numpy.bool_'>
test1(a)
test2(a)
wait_for_all_extensions()
# test1(a) # RuntimeError: Error while compiling code generated by Transonic.
# test2(a) # RuntimeError: Error while compiling code generated by Transonic.
Here's the full error:
ERROR: Error! File /home/daniel/.transonic/pythran/__jit__/__ipython__2a84652c03a07addf471009730705153/test1_e01fe91fc194dbb64a836622629125ff_39043f4db47a419004b852bfb822da1d.cpython-37m-x86_64-linux-gnu.so has not been created by pythran
Pythran stderr:
CRITICAL: I am in trouble. Your input file does not seem to match Pythran's constraints...
E: Invalid Pythran spec near 'bool_' (line 2)