提交 f859885d authored 作者: Frederic Bastien's avatar Frederic Bastien

Allow the Theano flag mode to be an instance of a Mode.

上级 6ed53c70
......@@ -466,12 +466,22 @@ AddConfigVar(
# scalable.
# Also, please be careful not to modify the first item in the enum when adding
# new modes, since it is the default mode.
def filter_mode(val):
if val in ['Mode', 'DebugMode', 'FAST_RUN',
'NanGuardMode',
'FAST_COMPILE', 'DEBUG_MODE']:
return val
elif isinstance(val, theano.Mode):
return val
else:
raise ValueError("Expected one of those string 'Mode', 'DebugMode',"
" 'FAST_RUN', 'NanGuardMode', 'FAST_COMPILE',"
" 'DEBUG_MODE' or an instance of Mode.")
AddConfigVar(
'mode',
"Default compilation mode",
EnumStr('Mode', 'DebugMode', 'FAST_RUN',
'NanGuardMode',
'FAST_COMPILE', 'DEBUG_MODE'),
ConfigParam('Mode', filter_mode),
in_c_key=False)
param = "g++"
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论