Open ngharrison opened 5 years ago
note: edited report with markdown syntax.
Thanks for the report, I can reproduce. I think this is because the outer list is typed by the first declared inner list, i.e. first inner list is a list(float64)
which makes the outer list list(list(float64))
, however the second declared inner list is typed as a list(int64)
. The problem occurs when generating the LLVM code as the assumption of homogeneous nested list types is broken by the list(int64)
inferred type, hence assertion error.
Minimal reproducer:
import numpy as np
from numba import njit
@njit
def f():
return [[1, 2.1], [0, 1]]
print(f())
I encountered the same problem today. I guess my only option is to create a 1-D array and reshaping it?
I encountered the same problem today. I guess my only option is to create a 1-D array and reshaping it?
I think so. Either that or using at least one float
values in all nested lists?
I am creating a 2D numpy array with a mix of ints and floats:
It fails with the following errors:
If I explicitly supply the dtype, the same errors occur:
It works fine if at least one element in each sub-list is a float:
I expect this isn't the desired behavior.