提交 0a839391 authored 作者: Ricardo Vieira's avatar Ricardo Vieira 提交者: Ricardo Vieira

Add more informative suggestion when iterating over Tensors

上级 86ca1853
......@@ -616,9 +616,9 @@ class _tensor_py_operators:
except TypeError:
# This prevents accidental iteration via sum(self)
raise TypeError(
"TensorType does not support iteration. "
"Maybe you are using builtins.sum instead of "
"pytensor.tensor.math.sum? (Maybe .max?)"
"TensorType does not support iteration.\n"
"\tDid you pass a PyTensor variable to a function that expects a list?\n"
"\tMaybe you are using builtins.sum instead of pytensor.tensor.sum?"
)
@property
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论