提交 204e3640 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

regard None as not scalar

上级 82642e99
...@@ -482,6 +482,11 @@ def get_scalar_constant_value(v): ...@@ -482,6 +482,11 @@ def get_scalar_constant_value(v):
code, but I'm not sure where it is. code, but I'm not sure where it is.
""" """
if v is None:
# None is not a scalar (and many uses of this function seem to depend
# on passing it None)
raise NotScalarConstantError()
if isinstance(v, Constant): if isinstance(v, Constant):
if getattr(v.tag, 'unique_value', None) is not None: if getattr(v.tag, 'unique_value', None) is not None:
data = v.tag.unique_value data = v.tag.unique_value
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论