Skip to content

Commit d752768

Browse files
committed
Fix scale grad
1 parent 89728f8 commit d752768

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

paddle/fluid/framework/details/scale_loss_grad_op_handle.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ ScaleLossGradOpHandle::~ScaleLossGradOpHandle() {}
3030

3131
void ScaleLossGradOpHandle::RunImpl() {
3232
std::string var_name = static_cast<VarHandle *>(this->outputs_[0])->name_;
33+
auto &local_scope = *scope_->FindVar(kLocalExecScopeName)->Get<Scope *>();
3334

34-
float *tmp =
35-
scope_->FindVar(var_name)->GetMutable<LoDTensor>()->mutable_data<float>(
36-
make_ddim({1}), place_);
35+
float *tmp = local_scope.FindVar(var_name)
36+
->GetMutable<LoDTensor>()
37+
->mutable_data<float>(make_ddim({1}), place_);
3738

3839
if (platform::is_cpu_place(place_)) {
3940
*tmp = coeff_;

0 commit comments

Comments
 (0)