!23040 [MS][LITE][CPU] matmul resize bug

Merge pull request !23040 from liuzhongkai/resize_bug
This commit is contained in:
i-robot 2021-09-08 08:16:56 +00:00 committed by Gitee
commit 3b9d7286c2
2 changed files with 10 additions and 3 deletions

View File

@ -52,6 +52,7 @@ void MatmulFp32BaseCPUKernel::InitParameter() {
}
void MatmulFp32BaseCPUKernel::ResizeParameter() {
init_global_variable();
if (params_->row_ == 1) {
vec_matmul_ = true;
#ifdef ENABLE_AVX
@ -277,9 +278,7 @@ int MatmulFp32BaseCPUKernel::FloatRun(int task_id) const {
return RET_OK;
}
int MatmulFp32BaseCPUKernel::Init() {
CHECK_LESS_RETURN(in_tensors_.size(), C2NUM);
CHECK_LESS_RETURN(out_tensors_.size(), 1);
void MatmulFp32BaseCPUKernel::init_global_variable() {
#ifdef ENABLE_AVX
matrix_a_pack_fun_ = params_->a_transpose_ ? RowMajor2Row6Major : RowMajor2Col6Major;
matrix_b_pack_fun_ = params_->b_transpose_ ? RowMajor2Col16Major : RowMajor2Row16Major;
@ -302,6 +301,13 @@ int MatmulFp32BaseCPUKernel::Init() {
col_tile_ = C8NUM;
#endif
params_->row_align_ = UP_ROUND(params_->row_, row_tile_);
vec_matmul_ = false;
}
int MatmulFp32BaseCPUKernel::Init() {
CHECK_LESS_RETURN(in_tensors_.size(), C2NUM);
CHECK_LESS_RETURN(out_tensors_.size(), 1);
init_global_variable();
matrix_a_pack_size_ = params_->batch * params_->row_align_ * params_->deep_;
if (matrix_a_pack_size_ < 0) {
MS_LOG(ERROR) << "Matrix pack size is negative "

View File

@ -52,6 +52,7 @@ class MatmulFp32BaseCPUKernel : public InnerKernel {
void FreeBiasBuf();
int InitBiasData();
void InitParameter();
void init_global_variable();
private:
void ResizeParameter();