From e11e41a60a86448ac080cbec62f66deb52a73bee Mon Sep 17 00:00:00 2001 From: zhiqiu Date: Sun, 27 Sep 2020 16:13:38 +0800 Subject: [PATCH] fix NumpyArrayInitializer --- python/paddle/fluid/initializer.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/python/paddle/fluid/initializer.py b/python/paddle/fluid/initializer.py index d98506fc94f..7a92adf0a89 100644 --- a/python/paddle/fluid/initializer.py +++ b/python/paddle/fluid/initializer.py @@ -875,18 +875,17 @@ class NumpyArrayInitializer(Initializer): self._value = value def __call__(self, var, block=None): - """Add constant initialization ops for a variable + """Initialize the input tensor with Numpy array. Args: - var: Variable that needs to be initialized - block: The block in which initialization ops - should be added + var(Tensor): Tensor that needs to be initialized. + block(Block, optional): The block in which initialization ops + should be added. Used in static graph only, default None. Returns: - the initialization op + The initialization op """ - if block is None: - block = default_main_program().global_block() + block = self._check_block(block) assert isinstance(var, framework.Variable) assert isinstance(block, framework.Block) -- GitLab