提交 70def42c authored 作者: Frederic's avatar Frederic

Updated user warning to tell where we have the OrderedDict implemented.

上级 c2b55ad7
......@@ -171,7 +171,8 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
" got " + str(type(updates)) + ". Using "
"a standard dictionary here results in "
"non-deterministic behavior. You should use an OrderedDict"
" if you are using Python 2.7, or use a list of (shared, update)"
" if you are using Python 2.7 (theano.compat.python2x.OrderedDict"
" for older python), or use a list of (shared, update)"
" pairs. Do not just convert your dictionary to this type before"
" the call as the conversion will still be non-deterministic.",
stacklevel=2)
......
......@@ -32,7 +32,10 @@ class OrderedUpdates(OrderedDict):
# Warn when using as input a non-ordered dictionary.
warnings.warn('Initializing an `OrderedUpdates` from a '
'non-ordered dictionary with 2+ elements could '
'make your code non-deterministic')
'make your code non-deterministic. You can use '
'an OrderedDict that is implemented at '
'theano.compat.python2x.OrderedDict '
'for python 2.4+.')
super(OrderedUpdates, self).__init__(*key, **kwargs)
for key in self:
if not isinstance(key, SharedVariable):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论