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

Function write_tensor_f32_slice

src/framework/core/backend.cpp:433–446  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

431 ", got " + std::to_string(count));
432 }
433 ggml_backend_tensor_set(tensor.tensor, values, 0, count * sizeof(float));
434}
435
436void write_tensor_f32_slice(const TensorValue & tensor, size_t element_offset, const float * values, size_t count) {
437 if (tensor.type != GGML_TYPE_F32) {
438 throw std::runtime_error("write_tensor_f32_slice requires GGML_TYPE_F32 tensor");
439 }
440 const size_t total = static_cast<size_t>(tensor.shape.num_elements());
441 if (element_offset > total || count > total - element_offset) {
442 throw std::runtime_error("write_tensor_f32_slice range exceeds tensor shape");
443 }
444 ggml_backend_tensor_set(
445 tensor.tensor,
446 values,
447 element_offset * sizeof(float),
448 count * sizeof(float));
449}

Callers 2

run_in_placeMethod · 0.85
import_stateMethod · 0.85

Calls 2

ggml_backend_tensor_setFunction · 0.85
num_elementsMethod · 0.80

Tested by

no test coverage detected