diff --git a/paddle/fluid/eager/accumulation/accumulation_node.cc b/paddle/fluid/eager/accumulation/accumulation_node.cc index c271d9f49377fb4a89fce0bb7cf0f012c1032504..c95b08382b8ca655d94f73d4a5a323f962d731a0 100644 --- a/paddle/fluid/eager/accumulation/accumulation_node.cc +++ b/paddle/fluid/eager/accumulation/accumulation_node.cc @@ -46,7 +46,7 @@ static void CopyOrAddTensor(paddle::Tensor* tensor, if (LIKELY(t.is_dense_tensor())) { if (LIKELY(tensor->is_dense_tensor())) { if (t.is_custom_device()) { - *tensor = add_ad_func(t, *tensor); + add__ad_func(*tensor, t); } else { paddle::imperative::TensorAdd(t, tensor); } @@ -71,7 +71,7 @@ static void CopyOrAddTensor(paddle::Tensor* tensor, paddle::Tensor tensor_values(std::make_shared( tensor_sparse->non_zero_elements())); if (t.is_custom_device()) { - tensor_values = add_ad_func(t_values, tensor_values); + add__ad_func(tensor_values, t_values); } else { paddle::imperative::TensorAdd(t_values, &tensor_values);