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

Function write_tensor_f32

src/framework/core/backend.cpp:419–431  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

417}
418
419void write_tensor_f32(const TensorValue & tensor, const float * values, size_t count) {
420 if (tensor.type != GGML_TYPE_F32) {
421 throw std::runtime_error("write_tensor_f32 requires GGML_TYPE_F32 tensor");
422 }
423 if (tensor.shape.num_elements() != static_cast<int64_t>(count)) {
424 throw std::runtime_error(
425 "write_tensor_f32 value count does not match tensor shape for tensor '" +
426 std::string(tensor.tensor != nullptr ? tensor.tensor->name : "<null>") +
427 "': expected " + std::to_string(tensor.shape.num_elements()) +
428 ", got " + std::to_string(count));
429 }
430 ggml_backend_tensor_set(tensor.tensor, values, 0, count * sizeof(float));
431}
432
433void write_tensor_f32_slice(const TensorValue & tensor, size_t element_offset, const float * values, size_t count) {
434 if (tensor.type != GGML_TYPE_F32) {

Callers 15

flushMethod · 0.70
encode_layersMethod · 0.50
ensure_graphMethod · 0.50
upload_runtime_masksMethod · 0.50
encodeMethod · 0.50
runMethod · 0.50
import_stateMethod · 0.50
runMethod · 0.50
run_projectedMethod · 0.50
infer_16k_monoMethod · 0.50
runMethod · 0.50
runMethod · 0.50

Calls 6

ggml_backend_tensor_setFunction · 0.85
num_elementsMethod · 0.80
stringFunction · 0.50
to_stringFunction · 0.50
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected