diff --git a/paddle/fluid/operators/fill_constant_op.cc b/paddle/fluid/operators/fill_constant_op.cc index 4c63b9969fd10ca57258f337aef2ce34df926c6c..85aadcb07ad32b2d1b08a21916ceb236a9fc8c00 100644 --- a/paddle/fluid/operators/fill_constant_op.cc +++ b/paddle/fluid/operators/fill_constant_op.cc @@ -70,11 +70,12 @@ class FillConstantOp : public framework::OperatorWithKernel { framework::OpKernelType GetExpectedKernelType( const framework::ExecutionContext &ctx) const override { - framework::OpKernelType kt = framework::OpKernelType( - framework::proto::VarType::Type(ctx.Attr("dtype")), - ctx.GetPlace()); - // TODO(zyfncg) The force_cpu and place_type are conflicted, it's a issue - // lefted before, and we may merge them in the future. + auto input_data_type = + framework::proto::VarType::Type(ctx.Attr("dtype")); + framework::OpKernelType kt = + framework::OpKernelType(input_data_type, ctx.GetPlace()); + // TODO(zyfncg) The force_cpu and place_type are conflicted, it's an issue + // left before, and we may merge them in the future. // In order to invoke new fill_constant kernel, the place of OpKernelType // will be setted by force_cpu and place_type here. if (ctx.Attr("force_cpu")) { @@ -104,9 +105,6 @@ class FillConstantOp : public framework::OperatorWithKernel { } #ifdef PADDLE_WITH_MKLDNN - auto input_data_type = - framework::proto::VarType::Type(ctx.Attr("dtype")); - if (this->CanMKLDNNBeUsed(ctx, input_data_type)) { return framework::OpKernelType(input_data_type, ctx.GetPlace(),