From 950aa8a178aacad6751627d8402063e329966748 Mon Sep 17 00:00:00 2001 From: wuyi05 Date: Tue, 9 May 2017 17:26:57 +0800 Subject: [PATCH] overwrite env with kwargs --- python/paddle/v2/__init__.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/paddle/v2/__init__.py b/python/paddle/v2/__init__.py index 0942334ca2..70c8ec0baa 100644 --- a/python/paddle/v2/__init__.py +++ b/python/paddle/v2/__init__.py @@ -43,14 +43,15 @@ __all__ = [ def init(**kwargs): args = [] + args_dict = {} # NOTE: append arguments if they are in ENV for ek, ev in os.environ.iteritems(): - if ek.startswith("PADDLE_"): - args.append('--%s=%s' % (ek.replace("PADDLE_", "").lower(), - str(ev))) + if ek.startswith("PADDLE_INIT_"): + args_dict[ek.replace("PADDLE_INIT_", "").lower()] = str(ev) + args_dict.update(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]))) api.initPaddle(*args) -- GitLab