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

Function read_tensor

examples/ggml_simple_inference.cpp:23–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23std::vector<float> read_tensor(const struct ggml_tensor * tensor) {
24 std::vector<float> values(static_cast<size_t>(ggml_nelements(tensor)));
25 for (int64_t i = 0; i < static_cast<int64_t>(values.size()); ++i) {
26 values[static_cast<size_t>(i)] = ggml_get_f32_1d(tensor, static_cast<int>(i));
27 }
28 return values;
29}
30
31void print_tensor(const std::string & name, const struct ggml_tensor * tensor) {
32 const auto values = read_tensor(tensor);

Callers 3

runMethod · 0.85
print_tensorFunction · 0.85
mainFunction · 0.85

Calls 3

ggml_nelementsFunction · 0.85
ggml_get_f32_1dFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected