提交 1253e750 authored 作者: Brandon T. Willard's avatar Brandon T. Willard 提交者: Brandon T. Willard

Adjust error and assert messages in MakeVector

上级 4fa6c415
...@@ -1611,14 +1611,13 @@ class MakeVector(COp): ...@@ -1611,14 +1611,13 @@ class MakeVector(COp):
dtype = aes.upcast(self.dtype, *[i.dtype for i in inputs]) dtype = aes.upcast(self.dtype, *[i.dtype for i in inputs])
# upcast the input to the determined dtype, # upcast the input to the determined dtype,
# but don't downcast anything # but don't downcast anything
assert dtype == self.dtype, ( assert (
"The upcast of the inputs to MakeVector should match the " dtype == self.dtype
"dtype given in __init__." ), f"Upcasted inputs do not match the Op's dtype: {dtype} != {self.dtype}"
)
if not all(self.dtype == cast(i, dtype=dtype).dtype for i in inputs): if not all(self.dtype == cast(i, dtype=dtype).dtype for i in inputs):
raise TypeError( raise TypeError(
"MakeVector.make_node expected inputs" f"Expected inputs upcastable to {self.dtype}; "
f" upcastable to {self.dtype}. got {[i.dtype for i in inputs]}" f"got {[i.dtype for i in inputs]}"
) )
inputs = [cast(i, dtype=dtype) for i in inputs] inputs = [cast(i, dtype=dtype) for i in inputs]
assert all(self.dtype == a.dtype for a in inputs) assert all(self.dtype == a.dtype for a in inputs)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论