diff --git a/paddle/fluid/ir_adaptor/translator/op_translator.cc b/paddle/fluid/ir_adaptor/translator/op_translator.cc index e22fa5f3b3779022791e54cc4d3c48f31634b4cc..86f31fd92ae90346cc6da073fb06d333ed801b08 100644 --- a/paddle/fluid/ir_adaptor/translator/op_translator.cc +++ b/paddle/fluid/ir_adaptor/translator/op_translator.cc @@ -1181,11 +1181,20 @@ struct FillConstant2FullTranscriber : public OpTranscriber { ctx, paddle::dialect::VarTypeToDataType( static_cast(dtype)))}}; + + if (op_desc.HasAttr("force_cpu")) { + bool force_cpu = PADDLE_GET_CONST(bool, op_desc.GetAttr("force_cpu")); + if (force_cpu) { + attribute_map["place"] = + paddle::dialect::PlaceAttribute::get(ctx, phi::CPUPlace()); + } + } + int place_type = PADDLE_GET_CONST(int, op_desc.GetAttr("place_type")); switch (place_type) { case -1: - attribute_map["place"] = - paddle::dialect::PlaceAttribute::get(ctx, phi::CPUPlace()); + attribute_map["place"] = paddle::dialect::PlaceAttribute::get( + ctx, phi::Place(phi::AllocationType::UNDEFINED)); break; case 0: attribute_map["place"] =