MCPcopy Create free account
hub / github.com/0xShug0/audio.cpp / encode_f32_tensor_data

Function encode_f32_tensor_data

src/framework/assets/tensor_source.cpp:268–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266 const int64_t rows_per_chunk = std::max<int64_t>(1, kQuantizeChunkElements / elements_per_row);
267 const int64_t chunks = (rows + rows_per_chunk - 1) / rows_per_chunk;
268
269 std::vector<size_t> written(static_cast<size_t>(chunks), 0);
270#ifdef _OPENMP
271#pragma omp parallel for schedule(static) if(chunks > 1)
272#endif
273 for (int64_t chunk = 0; chunk < chunks; ++chunk) {
274 const int64_t first_row = chunk * rows_per_chunk;
275 const int64_t count = std::min(rows_per_chunk, rows - first_row);
276 written[static_cast<size_t>(chunk)] = ggml_quantize_chunk(
277 type,
278 values.data(),
279 bytes.data(),
280 first_row * elements_per_row,
281 count,
282 elements_per_row,
283 nullptr);
284 }
285
286 const size_t total = std::accumulate(written.begin(), written.end(), size_t{0});

Callers 2

require_tensorMethod · 0.85

Calls 4

f32_bytesFunction · 0.85
f16_bytesFunction · 0.85
bf16_bytesFunction · 0.85
quantize_f32_rowsFunction · 0.85

Tested by

no test coverage detected