Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/316.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ember.js/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何用麻木做弦的铸造?_Python_Numba - Fatal编程技术网

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)处键入呼叫