Browse Source

!6638 [MSLITE][Develop] fix resize feature

Merge pull request !6638 from sunsuodong/fix_resize_bug
tags/v1.0.0
mindspore-ci-bot Gitee 5 years ago
parent
commit
ab0333e72f
2 changed files with 5 additions and 1 deletions
  1. +2
    -1
      mindspore/lite/src/lite_session.cc
  2. +3
    -0
      mindspore/lite/src/scheduler.cc

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

@@ -455,7 +455,7 @@ int LiteSession::ResizeInputs(const std::vector<mindspore::tensor::MSTensor *> &
MS_LOG(ERROR) << "Input[" << i << "] tensor is not equal to the inputs have been saved!";
return RET_PARAM_INVALID;
}
inputs_[i]->FreeData();
inputs_[i]->set_shape(dims[i]);
}
return RET_OK;
@@ -463,6 +463,7 @@ int LiteSession::ResizeInputs(const std::vector<mindspore::tensor::MSTensor *> &

void LiteSession::ResetInputsShape(const std::vector<std::vector<int>> &dims) {
for (size_t i = 0; i < inputs_.size(); ++i) {
inputs_[i]->FreeData();
inputs_[i]->set_shape(dims[i]);
}
}


+ 3
- 0
mindspore/lite/src/scheduler.cc View File

@@ -66,6 +66,9 @@ int Scheduler::ReSizeKernels(const std::vector<kernel::LiteKernel *> &kernels) {
}
std::vector<Tensor *> &inputs = kernels[i]->in_tensors();
std::vector<Tensor *> &outputs = kernels[i]->out_tensors();
for (size_t j = 0; j < outputs.size(); j++) {
outputs[j]->FreeData();
}
primitive->SetInferFlag(!infer_shape_interrupt);
auto ret = primitive->InferShape(inputs, outputs);
if (ret == RET_INFER_INVALID) {


Loading…
Cancel
Save