forked from OSSInnovation/mindspore
fix_resize_bug
This commit is contained in:
parent
6c26629404
commit
23d4f3783d
|
@ -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!";
|
MS_LOG(ERROR) << "Input[" << i << "] tensor is not equal to the inputs have been saved!";
|
||||||
return RET_PARAM_INVALID;
|
return RET_PARAM_INVALID;
|
||||||
}
|
}
|
||||||
|
inputs_[i]->FreeData();
|
||||||
inputs_[i]->set_shape(dims[i]);
|
inputs_[i]->set_shape(dims[i]);
|
||||||
}
|
}
|
||||||
return RET_OK;
|
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) {
|
void LiteSession::ResetInputsShape(const std::vector<std::vector<int>> &dims) {
|
||||||
for (size_t i = 0; i < inputs_.size(); ++i) {
|
for (size_t i = 0; i < inputs_.size(); ++i) {
|
||||||
|
inputs_[i]->FreeData();
|
||||||
inputs_[i]->set_shape(dims[i]);
|
inputs_[i]->set_shape(dims[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,9 @@ int Scheduler::ReSizeKernels(const std::vector<kernel::LiteKernel *> &kernels) {
|
||||||
}
|
}
|
||||||
std::vector<Tensor *> &inputs = kernels[i]->in_tensors();
|
std::vector<Tensor *> &inputs = kernels[i]->in_tensors();
|
||||||
std::vector<Tensor *> &outputs = kernels[i]->out_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);
|
primitive->SetInferFlag(!infer_shape_interrupt);
|
||||||
auto ret = primitive->InferShape(inputs, outputs);
|
auto ret = primitive->InferShape(inputs, outputs);
|
||||||
if (ret == RET_INFER_INVALID) {
|
if (ret == RET_INFER_INVALID) {
|
||||||
|
|
Loading…
Reference in New Issue