Initialise layer and tensor variables

This commit is contained in:
Ed Addario 2025-11-17 13:00:47 +00:00
parent 559ae9ab89
commit 5384a11b94
No known key found for this signature in database
GPG Key ID: E7875815A3230993
1 changed files with 6 additions and 9 deletions

View File

@ -99,13 +99,14 @@ static std::string filter_tensor_name(const char * name) {
}
static void process_tensor_name(const std::string & input, std::string & layer, std::string & tensor) {
layer.clear();
tensor.clear();
std::vector<std::string> name;
std::istringstream stream(input);
std::string item;
while (std::getline(stream, item, '.')) {
name.push_back(item);
}
while (std::getline(stream, item, '.')) { name.push_back(item); }
for (size_t i = 0; i < name.size(); ++i) {
if (name[i] == "blk" && i + 1 < name.size()) {
layer = name[i + 1];
@ -119,12 +120,8 @@ static void process_tensor_name(const std::string & input, std::string & layer,
}
}
if (tensor.empty()) {
tensor = input;
}
if (layer.empty()) {
layer = "-";
}
if (tensor.empty()) { tensor = input; }
if (layer.empty()) { layer = "-"; }
}
static std::vector<float> compute_tensor_averages(const Stats & tstats) {