From e16953888603cb429184256c6b65c005021d5086 Mon Sep 17 00:00:00 2001 From: hong <43953930+phlrain@users.noreply.github.com> Date: Fri, 30 Aug 2019 10:00:01 +0800 Subject: [PATCH] fix kernel config bug in dygraph mode; test=develop (#19532) --- paddle/fluid/imperative/layer.cc | 4 ++-- paddle/fluid/imperative/layer.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/imperative/layer.cc b/paddle/fluid/imperative/layer.cc index fb22d334902..1f7374e4126 100644 --- a/paddle/fluid/imperative/layer.cc +++ b/paddle/fluid/imperative/layer.cc @@ -376,8 +376,8 @@ std::vector OpBase::ApplyGrad( framework::Scope scope; PreparedOp p = PreparedOp::Prepare(ctx, *op_kernel, place_); p.op.RuntimeInferShape(scope, place_, ctx); - p.func( - framework::ExecutionContext(p.op, scope, *p.dev_ctx, p.ctx, nullptr)); + p.func(framework::ExecutionContext(p.op, scope, *p.dev_ctx, p.ctx, + p.kernel_configs)); } platform::RecordEvent record_event("merge_grads"); diff --git a/paddle/fluid/imperative/layer.h b/paddle/fluid/imperative/layer.h index 2fbedd82ea5..ba4be301c28 100644 --- a/paddle/fluid/imperative/layer.h +++ b/paddle/fluid/imperative/layer.h @@ -98,6 +98,7 @@ class PreparedOp { } std::vector* kernel_configs = op.GetKernelConfig(expected_kernel_key); + return PreparedOp(op, ctx, kernel_iter->second, dev_ctx, kernel_configs); } -- GitLab