From 0d644fab9205fe6eac0e5605297ffe2b2e0203df Mon Sep 17 00:00:00 2001 From: TUNG LEDUC Date: Fri, 15 Nov 2019 01:11:05 +0900 Subject: [PATCH] [MLIR] Legalize output tensors' names (#368) * [MLIR] legalize output tensor's name * Update frontend_dialect_transformer.cpp --- src/builder/frontend_dialect_transformer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/builder/frontend_dialect_transformer.cpp b/src/builder/frontend_dialect_transformer.cpp index 2b5810f..9851c08 100644 --- a/src/builder/frontend_dialect_transformer.cpp +++ b/src/builder/frontend_dialect_transformer.cpp @@ -238,16 +238,19 @@ class FrontendGenImpl { } void ImportOutputTensor(onnx::ValueInfoProto& output) { - if (frontend_symbols_.ContainKey(legalize_name(output.name()))) { + auto output_tensor_legalized_name = legalize_name(output.name()); + if (frontend_symbols_.ContainKey(output_tensor_legalized_name)) { mlir::OperationState result( - UnknownLoc(), "frontend.output " + output.name()); + UnknownLoc(), "frontend.output " + output_tensor_legalized_name); mlir::Type elementType = TypeConvert(output.type().tensor_type().elem_type()); result.addTypes(mlir::UnrankedTensorType::get(elementType)); - result.addOperands(frontend_symbols_.GetTensorByOnnxName(output.name())); + result.addOperands(frontend_symbols_.GetTensorByOnnxName( + output_tensor_legalized_name)); builder_.createOperation(result); } else { // TODO: Why not in the symbol table? something is wrong + assert(false && "output name not found"); } }