提交 4441b2d1 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

fixed (pre-existing) problem with way we checked if consider_constant

was iterable
上级 757b4407
...@@ -626,7 +626,9 @@ def _populate_var_to_node_to_idx(outputs, wrt, consider_constant): ...@@ -626,7 +626,9 @@ def _populate_var_to_node_to_idx(outputs, wrt, consider_constant):
# this is important, if someone accidentally passes a nested data # this is important, if someone accidentally passes a nested data
# structure with theano variables at the leaves, only the root will # structure with theano variables at the leaves, only the root will
# be properly considered constant # be properly considered constant
if not hasattr(consider_constant, '__iter__'): try:
iter(consider_constant)
except TypeError:
raise TypeError('consider_constant must be an iterable collection,' raise TypeError('consider_constant must be an iterable collection,'
' got ' + str(type(consider_constant))) ' got ' + str(type(consider_constant)))
for elem in consider_constant: for elem in consider_constant:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论