diff --git a/python/paddle/fluid/initializer.py b/python/paddle/fluid/initializer.py index d98506fc94fcd3a258d4bdda53f66c48c643f38a..7a92adf0a89dca688ba179da2b9fd471a186ac26 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)