无法将列表类型[tuple(float64 x 2)]强制转换为numba中的列表(tuple(float64 x 2))

时间:2019-10-31 23:21:46

标签: numba

你好,我试图在numba v46.0中使用类型化列表

>>> from numba.typed import List
>>> from numba import types
>>> mylist = List.empty_list(item_type=types.Tuple((types.f8, types.f8)))
>>> mylist2 = List.empty_list(item_type=types.List(dtype=types.Tuple((types.f8, types.f8))))
>>> mylist2.append(mylist)

但是出现以下错误,我想知道如何解决?

  

回溯(最近一次通话最后一次):文件“”,第1行,在      文件   “ /usr/local/lib/python3.7/site-packages/numba/typed/typedlist.py”,   附录中的第223行       _append(自身,项目)文件“ /usr/local/lib/python3.7/site-packages/numba/dispatcher.py”,行   401,在_compile_for_args中       error_rewrite(e,'typing')文件“ /usr/local/lib/python3.7/site-packages/numba/dispatcher.py”,行   344,在error_rewrite中       reraise(type(e),e,None)文件“ /usr/local/lib/python3.7/site-packages/numba/six.py”,行668,在   加薪       提高值.with_traceback(tb)numba.errors.TypingError:在nopython模式管道中失败(步骤:nopython前端)内部错误   。失败   nopython模式管道(步骤:nopython模式后端)无法转换   ListType [tuple(float64 x 2)]到list(tuple(float64 x 2)):%“。24” =   加载{i8 *,i8 *},{i8 *,i8 *} *%“ item”

     

文件   “ ../../usr/local/lib/python3.7/site-packages/numba/listobject.py”,   第434行:       def impl(l,item):           casteditem = _cast(item,itemty)

1 个答案:

答案 0 :(得分:0)

以下应该可以工作

mylist2 = List.empty_list(item_type=types.ListType(itemty=types.Tuple((types.f8, types.f8))))