From bc601f58a249735b6047bd448085018f925b264b Mon Sep 17 00:00:00 2001 From: jzhang533 Date: Fri, 8 Sep 2023 15:09:59 +0800 Subject: [PATCH] fixing 55358 (#56448) * fixing 55358 * correct codestyle --- python/paddle/base/executor.py | 8 +------- test/legacy_test/test_layer_norm_op.py | 11 +++++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/python/paddle/base/executor.py b/python/paddle/base/executor.py index 830590d3394..42abbd1b3b7 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 76ce8bb2934..3eb4dbe42cc 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) -- GitLab