MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / process_tensor_name

Function process_tensor_name

tools/imatrix/imatrix.cpp:100–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100static 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
129static void compute_statistics(std::vector<tensor_statistics> & tstats, const std::string & name, const Stats & e) {
130 if (e.values.size() % e.counts.size() != 0) {

Callers 2

operator()Method · 0.85
show_statisticsFunction · 0.85

Calls 3

push_backMethod · 0.45
sizeMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected