提交 7ae5ae3c authored 作者: ricardoV94's avatar ricardoV94 提交者: Ricardo Vieira

Handle incompatible issues with numba and c unboxing of boolean scalars

上级 9352166c
......@@ -255,8 +255,11 @@ class Convolve2d(AbstractConvolveNd, Op): # type: ignore[misc]
def perform(self, node, inputs, outputs):
in1, in2, full_mode = inputs
# TODO: Why is .item() needed?
mode: Literal["full", "valid", "same"] = "full" if full_mode.item() else "valid"
if isinstance(full_mode, np.bool):
# Patch for wrong unboxing of bool scalars in C backend
# Conditional, because numba will produce a bool, not np.bool_
full_mode = full_mode.item()
mode = "full" if full_mode else "valid"
outputs[0][0] = scipy_convolve(in1, in2, mode=mode, method=self.method)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论