未验证 提交 136b1f42 编写于 作者: H HongyuJia 提交者: GitHub

opt GetExpectedKernelType code of fill_constant_op (#46667)

上级 9900ed52
......@@ -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<int>("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<int>("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<bool>("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<int>("dtype"));
if (this->CanMKLDNNBeUsed(ctx, input_data_type)) {
return framework::OpKernelType(input_data_type,
ctx.GetPlace(),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册