提交 556500bb authored 作者: AdeB's avatar AdeB

Remove default value when flag is not found in the flag dictionary

上级 3be031f8
...@@ -138,7 +138,7 @@ def fetch_val_for_key(key, delete_key=False): ...@@ -138,7 +138,7 @@ def fetch_val_for_key(key, delete_key=False):
# first try to find it in the FLAGS # first try to find it in the FLAGS
try: try:
if delete_key: if delete_key:
return THEANO_FLAGS_DICT.pop(key, None) return THEANO_FLAGS_DICT.pop(key)
return THEANO_FLAGS_DICT[key] return THEANO_FLAGS_DICT[key]
except KeyError: except KeyError:
pass pass
...@@ -272,7 +272,7 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True): ...@@ -272,7 +272,7 @@ def AddConfigVar(name, doc, configparam, root=config, in_c_key=True):
# Trigger a read of the value from config files and env vars # Trigger a read of the value from config files and env vars
# This allow to filter wrong value from the user. # This allow to filter wrong value from the user.
if not callable(configparam.default): if not callable(configparam.default):
configparam.__get__(root, type(root)) configparam.__get__(root, type(root), delete_key=True)
else: else:
# We do not want to evaluate now the default value # We do not want to evaluate now the default value
# when it is a callable. # when it is a callable.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论