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 auto bytes = quantize_f32_rows(name, values, shape, type);
267 set_tensor_bytes(tensor, bytes.data(), bytes.size(), name);
268}
269
270} // namespace
271
272void set_backend_tensor_from_f32_parallel(
273 ggml_tensor * tensor,
274 std::string_view name,
275 const std::vector<float> & values,
276 const core::TensorShape & shape,
277 ggml_type type) {
278 if (static_cast<int64_t>(values.size()) < kParallelF32ConvertElements ||
279 (type != GGML_TYPE_F16 && type != GGML_TYPE_BF16)) {
280 set_backend_tensor_from_f32(tensor, name, values, shape, type);
281 return;
282 }
283
284 if (type == GGML_TYPE_F16) {
285 std::vector<ggml_fp16_t> converted(values.size());
286 const int64_t count = static_cast<int64_t>(values.size());

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