| 98 | } |
| 99 | |
| 100 | static void process_tensor_name(const std::string & input, std::string & layer, std::string & tensor) { |
| 101 | std::vector<std::string> name; |
| 102 | std::istringstream stream(input); |
| 103 | std::string item; |
| 104 | |
| 105 | while (std::getline(stream, item, '.')) { |
| 106 | name.push_back(item); |
| 107 | } |
| 108 | for (size_t i = 0; i < name.size(); ++i) { |
| 109 | if (name[i] == "blk" && i + 1 < name.size()) { |
| 110 | layer = name[i + 1]; |
| 111 | break; |
| 112 | } |
| 113 | } |
| 114 | for (size_t i = 0; i < name.size(); ++i) { |
| 115 | if (name[i] == "weight" && i > 0) { |
| 116 | tensor = name[i - 1]; |
| 117 | break; |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | if (tensor.empty()) { |
| 122 | tensor = input; |
| 123 | } |
| 124 | if (layer.empty()) { |
| 125 | layer = "-"; |
| 126 | } |
| 127 | } |
| 128 | |
| 129 | static void compute_statistics(std::vector<tensor_statistics> & tstats, const std::string & name, const Stats & e) { |
| 130 | if (e.values.size() % e.counts.size() != 0) { |
no test coverage detected