未验证 提交 d0e5fc1b 编写于 作者: W wanghuancoder 提交者: GitHub

fix cast vector of int64 bug (#56566)

上级 dadfb099
...@@ -1166,8 +1166,8 @@ struct FillConstant2FullTranscriber : public OpTranscriber { ...@@ -1166,8 +1166,8 @@ struct FillConstant2FullTranscriber : public OpTranscriber {
const std::string& normalized_op_name, const std::string& normalized_op_name,
const OpAttributeInfoList& op_attr_infos, const OpAttributeInfoList& op_attr_infos,
const OpDesc& op_desc) override { const OpDesc& op_desc) override {
std::vector<int64_t> shape = auto& attribute_translator = AttributeTranslator::instance();
PADDLE_GET_CONST(std::vector<int64_t>, op_desc.GetAttr("shape")); paddle::framework::Attribute shape_attr = op_desc.GetAttr("shape");
float value = PADDLE_GET_CONST(float, op_desc.GetAttr("value")); float value = PADDLE_GET_CONST(float, op_desc.GetAttr("value"));
int dtype = PADDLE_GET_CONST(int, op_desc.GetAttr("dtype")); int dtype = PADDLE_GET_CONST(int, op_desc.GetAttr("dtype"));
...@@ -1175,7 +1175,8 @@ struct FillConstant2FullTranscriber : public OpTranscriber { ...@@ -1175,7 +1175,8 @@ struct FillConstant2FullTranscriber : public OpTranscriber {
ir::AttributeMap attribute_map = { ir::AttributeMap attribute_map = {
{"shape", {"shape",
paddle::dialect::IntArrayAttribute::get(ctx, phi::IntArray(shape))}, attribute_translator("paddle::dialect::IntArrayAttribute",
shape_attr)},
{"value", attr_value.dyn_cast<paddle::dialect::ScalarAttribute>()}, {"value", attr_value.dyn_cast<paddle::dialect::ScalarAttribute>()},
{"dtype", {"dtype",
paddle::dialect::DataTypeAttribute::get( paddle::dialect::DataTypeAttribute::get(
...@@ -1241,10 +1242,10 @@ struct FillConstant2FullWithTensorTranscriber : public OpTranscriber { ...@@ -1241,10 +1242,10 @@ struct FillConstant2FullWithTensorTranscriber : public OpTranscriber {
ctx, param_map, program, shape_tensor_list_vars); ctx, param_map, program, shape_tensor_list_vars);
op_inputs.push_back(defining_op->result(0)); op_inputs.push_back(defining_op->result(0));
} else { } else {
std::vector<int64_t> shape = auto& attribute_translator = AttributeTranslator::instance();
PADDLE_GET_CONST(std::vector<int64_t>, op_desc.GetAttr("shape")); paddle::framework::Attribute shape_attr = op_desc.GetAttr("shape");
ir::Attribute new_attr = ir::Attribute new_attr = attribute_translator(
paddle::dialect::IntArrayAttribute::get(ctx, phi::IntArray(shape)); "paddle::dialect::IntArrayAttribute", shape_attr);
auto defining_op = auto defining_op =
InsertFullArrayOperationForAttributeInput(ctx, program, new_attr); InsertFullArrayOperationForAttributeInput(ctx, program, new_attr);
op_inputs.push_back(defining_op->result(0)); op_inputs.push_back(defining_op->result(0));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册