提交 35513e07 authored 作者: Michael Osthege's avatar Michael Osthege 提交者: Brandon T. Willard

Make unused flags warning a method and use it in theano/__init__

This way all sub-packages get the chance to register their config variables without needing to be imported in theano.configdefaults.
上级 8b96d5f4
......@@ -199,3 +199,8 @@ def sparse_grad(var):
import theano.tensor.random.var
from theano.scan import checkpoints, clone, foldl, foldr, map, reduce, scan
# Some config variables are registered by submodules. Only after all those imports
# were executed, we can warn about remaining flags provided by the user through THEANO_FLAGS.
config.warn_unused_flags()
......@@ -2260,7 +2260,3 @@ except OSError:
# TODO: The caching dir resolution is a procedural mess of helper functions, local variables
# and config definitions. And the result is also not particularly pretty..
add_caching_dir_configvars()
# Check if there are remaining flags provided by the user through THEANO_FLAGS.
for key in config._flags_dict.keys():
warnings.warn(f"Theano does not recognise this flag: {key}")
......@@ -262,6 +262,10 @@ class TheanoConfigParser:
"""
return _ChangeFlagsDecorator(*args, _root=self, **kwargs)
def warn_unused_flags(self):
for key in self._flags_dict.keys():
warnings.warn(f"Theano does not recognise this flag: {key}")
class ConfigParam:
"""Base class of all kinds of configuration parameters.
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论