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

API(program_guard) error message enhancement (#23452)

* API(program_guard) error message enhancement test=develop

* fix Cycle import test=develop

* polish code according comment test=develop
上级 a00d0cb9
...@@ -4987,12 +4987,12 @@ def program_guard(main_program, startup_program=None): ...@@ -4987,12 +4987,12 @@ def program_guard(main_program, startup_program=None):
data = fluid.data(name='image', shape=[None, 784, 784], dtype='float32') data = fluid.data(name='image', shape=[None, 784, 784], dtype='float32')
""" """
if not isinstance(main_program, Program): from .data_feeder import check_type
raise TypeError("main_program should be Program") check_type(main_program, 'main_program', Program, 'fluid.program_guard')
main_program = switch_main_program(main_program) main_program = switch_main_program(main_program)
if startup_program is not None: if startup_program is not None:
if not isinstance(startup_program, Program): check_type(startup_program, 'startup_program', Program,
raise TypeError("startup_program should be Program") 'fluid.program_guard')
startup_program = switch_startup_program(startup_program) startup_program = switch_startup_program(startup_program)
yield yield
switch_main_program(main_program) switch_main_program(main_program)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册