0
假設我有2個類,A和B,我有jitted,其中B有一個列表A.這可能在numba嗎?我可以有一個嵌套的numba對象數組嗎?
from numba import jitclass, deferred_type
from numba.types import string
spec = [('name', string)]
@jitclass(spec)
class A:
def __init__(self, name):
self.name = name
a_type = deferred_type()
a_type.define(A.class_type.instance_type)
spec2 = [('name', string), ('alist', a_type[:])]
@jitclass(spec2)
class B:
def __init__(self, name, alist):
self.name = name
self.alist = alist
當我運行它,我得到以下錯誤:
python3: /opt/miniconda/conda-bld/llvmdev_1498055795382/work/llvm-4.0.0.src/lib/IR/DataLayout.cpp:638: unsigned int llvm::DataLayout::getAlignment(llvm::Type*, bool) const: Assertion `Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!"' failed.
Aborted (core dumped)
有沒有什麼辦法可以解決這個錯誤?