!15518 [MSLITE] Fix bug of fp16subgraph preprocess.

From: @wang_shaocong
Reviewed-by: @zhanghaibo5,@hangangqiang
Signed-off-by: @zhanghaibo5
This commit is contained in:
mindspore-ci-bot 2021-04-23 11:16:10 +08:00 committed by Gitee
commit 9122cdbbae
4 changed files with 7 additions and 4 deletions

View File

@ -31,6 +31,8 @@ int WhereInferShape(const TensorC *const *inputs, size_t inputs_size, TensorC **
// Need to dynamically allocate at runtime.
if (inputs_size == 1) {
output->data_type_ = kNumberTypeInt32;
output->format_ = input->format_;
return NNACL_INFER_INVALID;
}

View File

@ -89,7 +89,6 @@ int WhereCPUKernel::RunWithSingleInput() {
}
}
}
out_tensors_.at(0)->set_data_type(kNumberTypeInt32);
std::vector<int> output_shape = {true_num, where_param_->rank_};
out_tensors_.at(0)->set_shape(output_shape);
out_tensors_.at(0)->FreeData();

View File

@ -226,12 +226,13 @@ int CpuFp16SubGraph::Float32TensorToFloat16Tensor(lite::Tensor *tensor) {
MS_ASSERT(tensor != nullptr);
auto float32_data = tensor->data_c();
auto own_data = tensor->own_data();
tensor->set_data_type(TypeId::kNumberTypeFloat16);
if (float32_data == nullptr) {
MS_LOG(ERROR) << "tensor data is null.";
return lite::RET_NULL_PTR;
// the input data may be nullptr of merge.
MS_LOG(INFO) << "tensor data is null.";
return lite::RET_OK;
}
tensor->set_data(nullptr);
tensor->set_data_type(TypeId::kNumberTypeFloat16);
auto ret = tensor->MallocData();
if (RET_OK != ret) {
MS_LOG(ERROR) << "malloc data failed";

View File

@ -85,3 +85,4 @@ Q_face_recognition.onnx 2
ml_video_edit_enhance_update_tmp.onnx 0.5
Q888_face_recognition.onnx 3.5
Q888_iris_detect.onnx 0.5
ssd_mobilenet_v1_10.onnx;1,383,640,3 0.5