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