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

Function print_tensor

examples/ggml_simple_inference.cpp:31–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

29}
30
31void print_tensor(const std::string & name, const struct ggml_tensor * tensor) {
32 const auto values = read_tensor(tensor);
33 const int64_t cols = tensor->ne[0];
34 const int64_t rows = tensor->ne[1];
35
36 std::cout << name << " (" << rows << "x" << cols << ")\n";
37 for (int64_t row = 0; row < rows; ++row) {
38 std::cout << " [";
39 for (int64_t col = 0; col < cols; ++col) {
40 const auto index = static_cast<size_t>(row * cols + col);
41 std::cout << std::fixed << std::setprecision(4) << values[index];
42 if (col + 1 < cols) {
43 std::cout << ", ";
44 }
45 }
46 std::cout << "]\n";
47 }
48}
49
50} // namespace
51

Callers 1

mainFunction · 0.85

Calls 1

read_tensorFunction · 0.85

Tested by

no test coverage detected