未验证 提交 0379e586 编写于 作者: K kangguangli 提交者: GitHub

fix api rename (#54592)

上级 3a3fb1fe
......@@ -71,7 +71,7 @@ phi::KernelKey GetKernelKey(
int in_index = input_map.at(slot_name);
dialect::AllocatedDenseTensorType type =
op->GetOperandByIndex(in_index)
op->operand(in_index)
.source()
.type()
.dyn_cast<paddle::dialect::AllocatedDenseTensorType>();
......@@ -98,7 +98,7 @@ phi::KernelKey GetKernelKey(
for (size_t i = 0; i < input_info.size(); ++i) {
// todo filter attribute tensor
auto input_tmp = op->GetOperandByIndex(i).source();
auto input_tmp = op->operand(i).source();
auto new_input_tmp = map_value_pair.at(input_tmp);
dialect::AllocatedDenseTensorType type =
new_input_tmp.type().dyn_cast<dialect::AllocatedDenseTensorType>();
......@@ -164,16 +164,13 @@ std::unique_ptr<ir::Program> PdOpLowerToKernelPass(ir::Program* prog) {
paddle::dialect::AllocatedDenseTensorType::get(
ctx,
phi::TransToPhiPlace(kernel_key.backend()),
(*it)
->GetResultByIndex(0)
.type()
.dyn_cast<dialect::DenseTensorType>());
(*it)->result(0).type().dyn_cast<dialect::DenseTensorType>());
// constuct input
std::vector<ir::OpResult> vec_inputs;
if ((*it)->name() != "pd.full_" && (*it)->num_operands() > 0) {
for (size_t i = 0; i < (*it)->num_operands(); ++i) {
auto cur_in = (*it)->GetOperandByIndex(i).source();
auto cur_in = (*it)->operand(i).source();
auto new_in = map_value_pair.at(cur_in);
vec_inputs.push_back(new_in);
......@@ -201,7 +198,7 @@ std::unique_ptr<ir::Program> PdOpLowerToKernelPass(ir::Program* prog) {
vec_inputs, op1_attribute, {allocated_dense_tensor_dtype}, op1_info);
map_op_pair[*it] = op1;
map_value_pair[(*it)->GetResultByIndex(0)] = op1->GetResultByIndex(0);
map_value_pair[(*it)->result(0)] = op1->result(0);
program->block()->push_back(op1);
}
......
......@@ -292,7 +292,7 @@ class PhiKernelAdaptor {
(*it), name_map, scope_, yaml_info, &kernel_ctx, false);
kernel_fn(&kernel_ctx);
auto out_value = (*it)->GetResultByIndex(0);
auto out_value = (*it)->result(0);
out_name = name_map[out_value];
}
}
......
......@@ -62,7 +62,7 @@ TEST(program_test, program) {
ctx->GetOrRegisterDialect<paddle::dialect::PaddleDialect>();
ir::Builder builder = ir::Builder::AtBlockEnd(ctx, program.block());
ir::Builder builder = ir::Builder(ctx, program.block());
paddle::dialect::FullOp op1 = builder.Build<paddle::dialect::FullOp>(
std::vector<int64_t>{2, 2}, 1.0, phi::DataType::FLOAT32, phi::CPUPlace());
......@@ -70,8 +70,7 @@ TEST(program_test, program) {
paddle::dialect::FullOp op2 = builder.Build<paddle::dialect::FullOp>(
std::vector<int64_t>{2, 2}, 1.0, phi::DataType::FLOAT32, phi::CPUPlace());
builder.Build<paddle::dialect::AddOp>(op1->GetResultByIndex(0),
op2->GetResultByIndex(0));
builder.Build<paddle::dialect::AddOp>(op1->result(0), op2->result(0));
auto kernel_program = paddle::dialect::PdOpLowerToKernelPass(&program);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册