Browse Source

!6828 [MSLITE][Develop] fix split output

Merge pull request !6828 from sunsuodong/fix_split_fp16
tags/v1.1.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
6855a8756f
2 changed files with 10 additions and 1 deletions
  1. +8
    -0
      mindspore/lite/src/runtime/kernel/arm/fp16/split_fp16.cc
  2. +2
    -1
      mindspore/lite/src/scheduler.cc

+ 8
- 0
mindspore/lite/src/runtime/kernel/arm/fp16/split_fp16.cc View File

@@ -17,6 +17,7 @@
#include "src/runtime/kernel/arm/fp16/common_fp16.h"
#include "src/runtime/kernel/arm/base/split_base.h"
#include "nnacl/fp16/split_fp16.h"
#include "nnacl/fp16/cast_fp16.h"
#include "nnacl/split.h"
#include "nnacl/split_parameter.h"
#include "src/kernel_registry.h"
@@ -94,6 +95,13 @@ int SplitFp16CPUKernel::Run() {
}
}
ret = ParallelLaunch(this->context_->thread_pool_, SplitRun, this, thread_n_num_);
for (int i = 0; i < param->num_split_; i++) {
if (out_tensors_.at(i)->data_type() == kNumberTypeFloat32) {
Float16ToFloat32(output_ptr_[i], reinterpret_cast<float *>(out_tensors_.at(i)->MutableData()),
out_tensors_.at(i)->ElementsNum());
}
}
FreeInputAndOutput();
if (ret != RET_OK) {
MS_LOG(ERROR) << "split error error_code[" << ret << "]";
}


+ 2
- 1
mindspore/lite/src/scheduler.cc View File

@@ -267,7 +267,8 @@ kernel::LiteKernel *Scheduler::ScheduleNode(const std::vector<Tensor *> &in_tens
kernel::KernelKey key{desc.arch, kNumberTypeFloat16, desc.type};
kernel = KernelRegistry::GetInstance()->GetKernel(in_tensors, out_tensors, primitive, context_, key);
if (kernel != nullptr) {
MS_LOG(DEBUG) << "Get fp16 op success.";
MS_LOG(INFO) << "Get fp16 op success. type:"
<< schema::EnumNamePrimitiveType(static_cast<schema::PrimitiveType>(primitive->Type()));
desc.data_type = kNumberTypeFloat16;
kernel->set_desc(desc);
return kernel;


Loading…
Cancel
Save