From 59265a99c1e99e88ce9222a6affc651153bbcb27 Mon Sep 17 00:00:00 2001 From: Jeff114514 <928430299@qq.com> Date: Thu, 8 Aug 2024 10:11:24 +0800 Subject: [PATCH] fix --- python/paddle/distributed/auto_parallel/static/reshard.py | 5 ++++- test/xpu/op_test_xpu.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/python/paddle/distributed/auto_parallel/static/reshard.py b/python/paddle/distributed/auto_parallel/static/reshard.py index 5920f8dbca663..c487c8b00124e 100644 --- a/python/paddle/distributed/auto_parallel/static/reshard.py +++ b/python/paddle/distributed/auto_parallel/static/reshard.py @@ -14,6 +14,7 @@ import copy +import operator from collections import OrderedDict from functools import reduce @@ -976,7 +977,9 @@ def remove_no_need_in_main( ) # 'feed_var_names' cannot be removed from auto_parallel_main_prog feed_var_names = [] - for var in sum(list(dist_context.serial_feed_vars.values()), []): + for var in reduce( + operator.iadd, list(dist_context.serial_feed_vars.values()), [] + ): feed_var_names.append(var.name) Remover.remove_no_need_vars( auto_parallel_main_prog, dist_params_grads, feed_var_names diff --git a/test/xpu/op_test_xpu.py b/test/xpu/op_test_xpu.py index b1aca39740452..d8aae7dbe6ea1 100644 --- a/test/xpu/op_test_xpu.py +++ b/test/xpu/op_test_xpu.py @@ -292,7 +292,7 @@ def get_grad_with_place( # oneDNN numeric gradient should use CPU kernel use_onednn = False - if "use_mkldnn" in op_attrs and op_attrs["use_mkldnn"]: + if op_attrs.get("use_mkldnn"): op_attrs["use_mkldnn"] = False use_onednn = True