diff --git a/python/paddle/base/executor.py b/python/paddle/base/executor.py index 830590d3394c74e78cb1f4da0be5f76ec6bd3e9c..42abbd1b3b717256e0f8c888f6cb61b42e2b0968 100755 --- a/python/paddle/base/executor.py +++ b/python/paddle/base/executor.py @@ -1721,13 +1721,7 @@ class Executor: "Please ensure you create model correctly or you can pass " "the Program or the CompiledProgram manually." ) - else: - error_info = ( - "There are no operators in the program to be executed. " - "If you pass Program manually, please use base.program_guard " - "to ensure the current Program is being used." - ) - warnings.warn(error_info) + warnings.warn(error_info) if scope is None: scope = global_scope() diff --git a/test/legacy_test/test_layer_norm_op.py b/test/legacy_test/test_layer_norm_op.py index 76ce8bb2934b5213bc4ec9af220fc70ac8c57258..3eb4dbe42cc01ed3792ad96c8d7aa3b463688972 100644 --- a/test/legacy_test/test_layer_norm_op.py +++ b/test/legacy_test/test_layer_norm_op.py @@ -639,12 +639,15 @@ class TestLayerNormOp(unittest.TestCase): program._sync_with_cpp() exe = base.Executor(place) + name_list = ['x', 'y@GRAD'] + if has_scale: + name_list += ['scale'] + if has_bias: + name_list += ['bias'] + out = exe.run( program, - feed={ - name: var_dict[name] - for name in ['x', 'scale', 'bias', 'y@GRAD'] - }, + feed={name: var_dict[name] for name in name_list}, fetch_list=fetch_list, ) # print(y)