diff --git a/paddle/fluid/imperative/layer.cc b/paddle/fluid/imperative/layer.cc index fb22d3349028f6a5ecb2dcbae8e8d08c6806ca1c..1f7374e4126966e644883fc88eec37389ef16b08 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 2fbedd82ea59a89fed20639ba4873889289a5a3b..ba4be301c28415af5d26c97ef598723542892248 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); }