Python 如何用麻木做弦的铸造?
也许我遗漏了一些文档,但我看不到任何解决方法或处理Python 如何用麻木做弦的铸造?,python,numba,Python,Numba,也许我遗漏了一些文档,但我看不到任何解决方法或处理str在numba中转换的方法 因此,即使使用numba.types.string也会失败(参见下面的代码) 如何在优化函数中转换为字符串 import numba as nb @nb.jit(nopython=True) def foo(a, b): f = nb.types.string(a) + b # f = str(a) + b return f foo(123, '456') 错误: numba.er
str
在numba
中转换的方法
因此,即使使用numba.types.string
也会失败(参见下面的代码)
如何在优化函数中转换为字符串
import numba as nb
@nb.jit(nopython=True)
def foo(a, b):
f = nb.types.string(a) + b
# f = str(a) + b
return f
foo(123, '456')
错误:
numba.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Invalid use of typeref[unicode_type] with parameters (int64)
No type info available for typeref[unicode_type] as a callable.
[1] During: resolving callee type: typeref[unicode_type]
[2] During: typing of call at <input> (5)
numba.errors.TypingError:在nopython模式管道中失败(步骤:nopython前端)
typeref[unicode_type]与参数(int64)的使用无效
typeref[unicode_type]没有可调用的类型信息。
[1] 在:解析被调用方类型期间:typeref[unicode\u type]
[2] 期间:在(5)处键入呼叫