未验证 提交 3b5bb4ba 编写于 作者: K kangguangli 提交者: GitHub

fix place setting when translatring fill_constant (#56929)

上级 b39a2ca5
......@@ -1181,11 +1181,20 @@ struct FillConstant2FullTranscriber : public OpTranscriber {
ctx,
paddle::dialect::VarTypeToDataType(
static_cast<paddle::framework::proto::VarType_Type>(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"] =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册