convert split bugfix master

This commit is contained in:
greatpan 2023-03-07 16:34:01 +08:00
parent 6c8e82c675
commit b370d06ae1
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); auto size = size_splits_tensor.tensor_content().size() / sizeof(int32_t);
std::vector<int32_t> size_splits_int32; std::vector<int32_t> size_splits_int32;
size_splits_int32.resize(size); if (size > 0) {
auto ret = memcpy_s(size_splits_int32.data(), size * sizeof(int32_t), size_splits_tensor.tensor_content().data(), size_splits_int32.resize(size);
size * sizeof(int32_t)); auto ret = memcpy_s(size_splits_int32.data(), size * sizeof(int32_t), size_splits_tensor.tensor_content().data(),
if (ret != EOK) { size * sizeof(int32_t));
MS_LOG(ERROR) << "memcpy_s failed"; if (ret != EOK) {
return nullptr; MS_LOG(ERROR) << "memcpy_s failed";
return nullptr;
}
} }
std::vector<int64_t> size_splits; std::vector<int64_t> size_splits;
std::transform(size_splits_int32.begin(), size_splits_int32.end(), std::back_inserter(size_splits), std::transform(size_splits_int32.begin(), size_splits_int32.end(), std::back_inserter(size_splits),