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

Function write_tensor_f16

src/framework/core/backend.cpp:452–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

450}
451
452void write_tensor_f32(const TensorValue & tensor, const float * values, size_t count) {
453 if (tensor.type != GGML_TYPE_F32) {
454 throw std::runtime_error("write_tensor_f32 requires GGML_TYPE_F32 tensor");
455 }
456 if (tensor.shape.num_elements() != static_cast<int64_t>(count)) {
457 throw std::runtime_error(
458 "write_tensor_f32 value count does not match tensor shape for tensor '" +
459 std::string(tensor.tensor != nullptr ? tensor.tensor->name : "<null>") +
460 "': expected " + std::to_string(tensor.shape.num_elements()) +
461 ", got " + std::to_string(count));
462 }
463 ggml_backend_tensor_set(tensor.tensor, values, 0, count * sizeof(float));
464}
465
466void write_tensor_f32_slice(const TensorValue & tensor, size_t element_offset, const float * values, size_t count) {
467 if (tensor.type != GGML_TYPE_F32) {
468 throw std::runtime_error("write_tensor_f32_slice requires GGML_TYPE_F32 tensor");
469 }

Callers 8

runMethod · 0.85
run_oneMethod · 0.85
decode_chunkMethod · 0.85
buildMethod · 0.85
encode_chunkMethod · 0.85
buildMethod · 0.85
ensure_attention_maskMethod · 0.85
stepMethod · 0.85

Calls 7

ggml_fp32_to_fp16_rowFunction · 0.85
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