From 70645e48072bf193fbf069949f1d2b10fddac8a3 Mon Sep 17 00:00:00 2001
From: pointerhacker <145901472+pointerhacker@users.noreply.github.com>
Date: 星期二, 15 十月 2024 17:50:51 +0800
Subject: [PATCH] 数据并行可能导致的模型训练报错 (#2139)

---
 runtime/onnxruntime/src/util.cpp |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/runtime/onnxruntime/src/util.cpp b/runtime/onnxruntime/src/util.cpp
index 483795e..50c9c82 100644
--- a/runtime/onnxruntime/src/util.cpp
+++ b/runtime/onnxruntime/src/util.cpp
@@ -646,6 +646,21 @@
   return elems;
 }
 
+std::vector<std::string> SplitStr(const std::string &s, string delimiter) {
+    std::vector<std::string> tokens;
+    size_t start = 0;
+    size_t end = s.find(delimiter);
+
+    while (end != std::string::npos) {
+        tokens.push_back(s.substr(start, end - start));
+        start = end + delimiter.length();
+        end = s.find(delimiter, start);
+    }
+    tokens.push_back(s.substr(start, end - start));
+
+    return tokens;
+}
+
 template<typename T>
 void PrintMat(const std::vector<std::vector<T>> &mat, const std::string &name) {
   std::cout << name << ":" << std::endl;

--
Gitblit v1.9.1