Hi all,
I’m trying to create an np.array from a list of np.arrays,
arr = np.array([a,b,c])
where a
, b
and c
are 1D numpy arrays.
This throws a TypingsError and I’ve tried to declare the signature type as:
@jit(types.Array(types.float64, 2, 'C')(types.List(types.Array(types.float64, 1, 'C'))), nopython=True)
def make_np_arr(x):
return np.array(x)
But I’m still getting an error like so:
There are 2 candidate implementations:
- Of which 2 did not match due to:
Overload in function 'array': File: numba/core/typing/npydecl.py: Line 482.
With argument(s): '(list(array(float64, 1d, C))<iv=None>)':
Rejected as the implementation raised a specific error:
TypingError: array(float64, 1d, C) not allowed in a homogeneous sequence
raised from /Users/briant/opt/anaconda3/envs/seam-carving/lib/python3.7/site-packages/numba/core/typing/npydecl.py:449
I’ve tried to overload np.array as well with the below, to no avail (adapted from here):
@overload(np.array)
def np_array_ol(x):
if (isinstance(x, types.List(types.Array(types.float64, 1, 'C'))):
def impl(x):
return np.copy(x)
return impl
Thanks,
Brian