提交 20e8eaf8 authored 作者: Ian Goodfellow's avatar Ian Goodfellow

change TypeError to warning

上级 8413d518
...@@ -12,6 +12,7 @@ from function_module import orig_function ...@@ -12,6 +12,7 @@ from function_module import orig_function
from profiling import ProfileStats from profiling import ProfileStats
from pfunc import pfunc from pfunc import pfunc
from numpy import any # to work in python 2.4 from numpy import any # to work in python 2.4
import warnings
def function(inputs, outputs=None, mode=None, updates=None, givens=None, def function(inputs, outputs=None, mode=None, updates=None, givens=None,
no_default_updates=False, accept_inplace=False, name=None, no_default_updates=False, accept_inplace=False, name=None,
...@@ -165,7 +166,7 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None, ...@@ -165,7 +166,7 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
# I use the string value of the type to do type checking here since # I use the string value of the type to do type checking here since
# OrderedDict is not available in python2.4 # OrderedDict is not available in python2.4
if isinstance(updates, dict) and 'Ordered' not in str(type(updates)): if isinstance(updates, dict) and 'Ordered' not in str(type(updates)):
raise TypeError("Expected OrderedDict, got "+str(type(updates))+ "Using " warnings.warn("Expected OrderedDict, got "+str(type(updates))+ "Using "
"a standard dictionary here results in " "a standard dictionary here results in "
"non-deterministic behavior. You should use an OrderedDict" "non-deterministic behavior. You should use an OrderedDict"
" if you are using python2.7 or use a list of (shared, update)" " if you are using python2.7 or use a list of (shared, update)"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论