Skip to content

Commit

Permalink
Fix default behavior if block=None in static mode (#37827) (#37898)
Browse files Browse the repository at this point in the history
Fix default behavior if block=None in static mode (#37827)
  • Loading branch information
Aurelius84 authored Dec 7, 2021
1 parent 81be365 commit 72a6c14
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions python/paddle/fluid/initializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ def __call__(self, param, block=None):

def _check_block(self, block):
if block is None:
if in_dygraph_mode():
block = default_main_program().global_block()
else:
raise ValueError(
"The parameter 'block' is needed in static graph mode.")
block = default_main_program().global_block()

return block

Expand Down

0 comments on commit 72a6c14

Please sign in to comment.