Browse Source

!10706 [MS_LITE]code dex

From: @YeFeng_24
Reviewed-by: @hangangqiang,@zhang_xue_tong
Signed-off-by: @hangangqiang,@zhang_xue_tong
tags/v1.2.0-rc1
mindspore-ci-bot Gitee 5 years ago
parent
commit
0b045f586e
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      mindspore/lite/tools/anf_exporter/anf_exporter.cc

+ 6
- 1
mindspore/lite/tools/anf_exporter/anf_exporter.cc View File

@@ -594,7 +594,12 @@ int AnfExporter::ConvertInputValueNode(const std::shared_ptr<AnfNode> &input_ano
paramTensor->dims = {static_cast<int32_t>(shape.size())}; paramTensor->dims = {static_cast<int32_t>(shape.size())};
paramTensor->nodeType = schema::NodeType_ValueNode; paramTensor->nodeType = schema::NodeType_ValueNode;
paramTensor->data.resize(shape.size() * sizeof(int)); paramTensor->data.resize(shape.size() * sizeof(int));
memcpy(paramTensor->data.data(), shape.data(), shape.size() * sizeof(int));
auto ret = memcpy_s(paramTensor->data.data(), shape.size() * sizeof(int32_t), shape.data(),
shape.size() * sizeof(int32_t));
if (ret != RET_OK) {
MS_LOG(ERROR) << "memcpy_s data into paramTensor failed.";
return RET_ERROR;
}
node_id_map_[valueNode->fullname_with_scope()] = meta_graphT->allTensors.size(); node_id_map_[valueNode->fullname_with_scope()] = meta_graphT->allTensors.size();
output_cnode->inputIndex.emplace_back(meta_graphT->allTensors.size()); output_cnode->inputIndex.emplace_back(meta_graphT->allTensors.size());
meta_graphT->allTensors.emplace_back(std::move(paramTensor)); meta_graphT->allTensors.emplace_back(std::move(paramTensor));


Loading…
Cancel
Save