未验证 提交 72a6c142 编写于 作者: A Aurelius84 提交者: GitHub

Fix default behavior if block=None in static mode (#37827) (#37898)

Fix default behavior if block=None in static mode (#37827)
上级 81be365f
...@@ -52,11 +52,7 @@ class Initializer(object): ...@@ -52,11 +52,7 @@ class Initializer(object):
def _check_block(self, block): def _check_block(self, block):
if block is None: if block is None:
if in_dygraph_mode(): block = default_main_program().global_block()
block = default_main_program().global_block()
else:
raise ValueError(
"The parameter 'block' is needed in static graph mode.")
return block return block
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册