gpt4 book ai didi

python - numba jit : 'DataFlowAnalysis' object has no attribute 'op_STORE_DEREF'

转载 作者:行者123 更新时间:2023-11-28 21:45:03 24 4
gpt4 key购买 nike

我正在尝试使用 numba 运行以下代码但出现错误:

from numba import jit

@jit(nopython=True)
def create_card_deck():
values = "23456789TJQKA"
suites = "CDHS"
Deck = []
[Deck.append(x + y) for x in values for y in suites]
return Deck

create_card_deck()

感谢任何导致此错误的建议:

'DataFlowAnalysis' object has no attribute 'op_STORE_DEREF'

最佳答案

这里有两个问题——更根本的一个是 numba 不支持 nopython 模式下的字符串

@jit(nopython=True)
def create_card_deck():
values = "23456789TJQKA"
suites = "CDHS"
return values

In [4]: create_card_deck()
---------------------------------------------------------------------------
NotImplementedError : Failed at nopython (nopython mode backend)
cannot convert native str to Python object

该特定错误是因为 nopython 模式目前也不支持列表理解。

https://github.com/numba/numba/issues/504

关于python - numba jit : 'DataFlowAnalysis' object has no attribute 'op_STORE_DEREF' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40069898/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com