提交 950aa8a1 编写于 作者: W wuyi05

overwrite env with kwargs

上级 444c4638
...@@ -43,14 +43,15 @@ __all__ = [ ...@@ -43,14 +43,15 @@ __all__ = [
def init(**kwargs): def init(**kwargs):
args = [] args = []
args_dict = {}
# NOTE: append arguments if they are in ENV # NOTE: append arguments if they are in ENV
for ek, ev in os.environ.iteritems(): for ek, ev in os.environ.iteritems():
if ek.startswith("PADDLE_"): if ek.startswith("PADDLE_INIT_"):
args.append('--%s=%s' % (ek.replace("PADDLE_", "").lower(), args_dict[ek.replace("PADDLE_INIT_", "").lower()] = str(ev)
str(ev)))
args_dict.update(kwargs)
# NOTE: overwrite arguments from ENV if it is in kwargs # NOTE: overwrite arguments from ENV if it is in kwargs
for key in kwargs.keys(): for key in args_dict.keys():
args.append('--%s=%s' % (key, str(kwargs[key]))) args.append('--%s=%s' % (key, str(kwargs[key])))
api.initPaddle(*args) api.initPaddle(*args)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册