From 8b5ea4147110d2992a6b51e464a85fcaf97821d2 Mon Sep 17 00:00:00 2001 From: zhaoying9105 Date: Wed, 10 Jun 2020 09:54:41 +0800 Subject: [PATCH] flatten & reshape bug (#113) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1 flatten & reshape 之前没有放到 paddle_use_bridges 中,现在放进去; 2 reshape 中 cnmlCreateNdReshapeOpParam dim_num 之前误写成4,应该是 output_dims.size() --- lite/kernels/mlu/bridges/paddle_use_bridges.h | 4 ++++ lite/kernels/mlu/bridges/reshape_op.cc | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lite/kernels/mlu/bridges/paddle_use_bridges.h b/lite/kernels/mlu/bridges/paddle_use_bridges.h index 9bd2f3357f..be5c64b3b7 100644 --- a/lite/kernels/mlu/bridges/paddle_use_bridges.h +++ b/lite/kernels/mlu/bridges/paddle_use_bridges.h @@ -39,6 +39,10 @@ USE_SUBGRAPH_BRIDGE(layout, kMLU); USE_SUBGRAPH_BRIDGE(slice, kMLU); USE_SUBGRAPH_BRIDGE(squeeze, kMLU); USE_SUBGRAPH_BRIDGE(squeeze2, kMLU); +USE_SUBGRAPH_BRIDGE(flatten, kMLU); +USE_SUBGRAPH_BRIDGE(flatten2, kMLU); +USE_SUBGRAPH_BRIDGE(reshape, kMLU); +USE_SUBGRAPH_BRIDGE(reshape2, kMLU); #ifdef LITE_BUILD_EXTRA USE_SUBGRAPH_BRIDGE(gather, kMLU); USE_SUBGRAPH_BRIDGE(lrn, kMLU) diff --git a/lite/kernels/mlu/bridges/reshape_op.cc b/lite/kernels/mlu/bridges/reshape_op.cc index 0b47322b34..4f55e5542b 100644 --- a/lite/kernels/mlu/bridges/reshape_op.cc +++ b/lite/kernels/mlu/bridges/reshape_op.cc @@ -67,8 +67,8 @@ int ReshapeConverter(void* ctx, OpLite* op, KernelBase* kernel) { int cnml_trans2_input_shape[4]; CNML_CALL( cnmlGetTensorShape(trans2_input->mlu_tensor(), cnml_trans2_input_shape)); - CNML_CALL( - cnmlCreateNdReshapeOpParam(&reshape_param, cnml_trans2_input_shape, 4)); + CNML_CALL(cnmlCreateNdReshapeOpParam( + &reshape_param, cnml_trans2_input_shape, output_dims.size())); // Use cnmlCreatexxxOpForward to create op. CNML_CALL(cnmlCreateReshapeOp(&reshape_op, -- GitLab