提交 6782253b authored 作者: Ian Goodfellow's avatar Ian Goodfellow

added type checking

上级 be890125
......@@ -617,6 +617,11 @@ class FunctionGraph(utils.object2):
raise TypeError("Non-deterministic return value from " \
+str(feature.orderings) \
+". Nondeterministic object is "+str(orderings))
for node, prereqs in orderings.items():
if not isinstance(prereqs, (list, OrderedSet)):
raise TypeError("prereqs must be a type with a "
"deterministic iteration order, or toposort "
" will be non-deterministic.")
ords.setdefault(node, []).extend(prereqs)
# eliminate duplicate prereqs
for (node,prereqs) in ords.items():
......
......@@ -15,6 +15,7 @@ import theano
import warnings
from theano.gof import utils
from theano.gof.python25 import any, deque
from theano.misc.ordered_set import OrderedSet
# Lazy imports to avoid circular dependencies.
is_same_graph_with_merge = None
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论