提交 4652fa7b authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Use to_scalar in numba_funcify_ScalarFromTensor

This should prevent errors when the input is already a Numba scalar, and it will use Numba's type information to selectively apply the scalar conversion.
上级 0b3d23aa
......@@ -230,6 +230,6 @@ def numba_funcify_TensorFromScalar(op, **kwargs):
def numba_funcify_ScalarFromTensor(op, **kwargs):
@numba_basic.numba_njit(inline="always")
def scalar_from_tensor(x):
return x.item()
return numba_basic.to_scalar(x)
return scalar_from_tensor
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论