Browse Source

fix name of tensor from StringToTensor

pull/14178/head
lixian 4 years ago
parent
commit
82aeb61e95
3 changed files with 6 additions and 6 deletions
  1. +4
    -0
      mindspore/lite/src/cxx_api/model/model.cc
  2. +0
    -4
      mindspore/lite/src/cxx_api/model/model_impl.cc
  3. +2
    -2
      mindspore/lite/src/cxx_api/tensor/tensor_impl.cc

+ 4
- 0
mindspore/lite/src/cxx_api/model/model.cc View File

@@ -23,6 +23,10 @@
namespace mindspore {

Status Model::Build(GraphCell graph, const std::shared_ptr<Context> &model_context) {
if (impl_ != nullptr) {
MS_LOG(DEBUG) << "Model has been already built.";
return kSuccess;
}
impl_ = std::shared_ptr<ModelImpl>(new (std::nothrow) ModelImpl());
if (impl_ == nullptr) {
MS_LOG(ERROR) << "Model implement is null.";


+ 0
- 4
mindspore/lite/src/cxx_api/model/model_impl.cc View File

@@ -37,10 +37,6 @@ using mindspore::lite::RET_OK;

Status ModelImpl::Build() {
MS_LOG(DEBUG) << "Start build model.";
if (session_ != nullptr) {
MS_LOG(DEBUG) << "Model has been already built.";
return kSuccess;
}
auto model = graph_->graph_data_->lite_model();
if (graph_ == nullptr || graph_->graph_data_ == nullptr || model == nullptr) {
MS_LOG(ERROR) << "Invalid graph.";


+ 2
- 2
mindspore/lite/src/cxx_api/tensor/tensor_impl.cc View File

@@ -67,14 +67,14 @@ MSTensor::Impl *MSTensor::Impl::StringsToTensorImpl(const std::string &name, con
delete lite_tensor;
return nullptr;
}
auto impl = new (std::nothrow) Impl();
auto impl = new (std::nothrow) Impl(lite_tensor);
if (impl == nullptr) {
delete lite_tensor;
MS_LOG(ERROR) << "Failed to allocate tensor impl.";
return nullptr;
}
impl->set_lite_tensor(lite_tensor);
impl->set_own_data(true);
impl->set_from_session(false);
return impl;
}



Loading…
Cancel
Save