Initialise layer and tensor variables
This commit is contained in:
parent
559ae9ab89
commit
5384a11b94
|
|
@ -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) {
|
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::vector<std::string> name;
|
||||||
std::istringstream stream(input);
|
std::istringstream stream(input);
|
||||||
std::string item;
|
std::string item;
|
||||||
|
|
||||||
while (std::getline(stream, item, '.')) {
|
while (std::getline(stream, item, '.')) { name.push_back(item); }
|
||||||
name.push_back(item);
|
|
||||||
}
|
|
||||||
for (size_t i = 0; i < name.size(); ++i) {
|
for (size_t i = 0; i < name.size(); ++i) {
|
||||||
if (name[i] == "blk" && i + 1 < name.size()) {
|
if (name[i] == "blk" && i + 1 < name.size()) {
|
||||||
layer = name[i + 1];
|
layer = name[i + 1];
|
||||||
|
|
@ -119,12 +120,8 @@ static void process_tensor_name(const std::string & input, std::string & layer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tensor.empty()) {
|
if (tensor.empty()) { tensor = input; }
|
||||||
tensor = input;
|
if (layer.empty()) { layer = "-"; }
|
||||||
}
|
|
||||||
if (layer.empty()) {
|
|
||||||
layer = "-";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<float> compute_tensor_averages(const Stats & tstats) {
|
static std::vector<float> compute_tensor_averages(const Stats & tstats) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue