!49917 [MS][LITE] convert split bugfix

Merge pull request !49917 from Greatpan/convert_split_bugfix_master
This commit is contained in:
i-robot 2023-03-08 02:11:48 +00:00 committed by Gitee
commit c38eb7c236
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
1 changed files with 8 additions and 6 deletions

View File

@ -74,12 +74,14 @@ PrimitiveCPtr TFSplitParser::Parse(const tensorflow::NodeDef &tf_op,
auto size = size_splits_tensor.tensor_content().size() / sizeof(int32_t);
std::vector<int32_t> size_splits_int32;
size_splits_int32.resize(size);
auto ret = memcpy_s(size_splits_int32.data(), size * sizeof(int32_t), size_splits_tensor.tensor_content().data(),
size * sizeof(int32_t));
if (ret != EOK) {
MS_LOG(ERROR) << "memcpy_s failed";
return nullptr;
if (size > 0) {
size_splits_int32.resize(size);
auto ret = memcpy_s(size_splits_int32.data(), size * sizeof(int32_t), size_splits_tensor.tensor_content().data(),
size * sizeof(int32_t));
if (ret != EOK) {
MS_LOG(ERROR) << "memcpy_s failed";
return nullptr;
}
}
std::vector<int64_t> size_splits;
std::transform(size_splits_int32.begin(), size_splits_int32.end(), std::back_inserter(size_splits),