MCPcopy Create free account
hub / github.com/antirez/llama.cpp-deepseek-v4-flash / common_ggml_get_float_value

Function common_ggml_get_float_value

common/debug.cpp:20–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20static float common_ggml_get_float_value(const uint8_t * data,
21 ggml_type type,
22 const size_t * nb,
23 size_t i0,
24 size_t i1,
25 size_t i2,
26 size_t i3) {
27 size_t i = i3 * nb[3] + i2 * nb[2] + i1 * nb[1] + i0 * nb[0];
28 float v;
29 if (type == GGML_TYPE_F16) {
30 v = ggml_fp16_to_fp32(*(const ggml_fp16_t *) &data[i]);
31 } else if (type == GGML_TYPE_F32) {
32 v = *(const float *) &data[i];
33 } else if (type == GGML_TYPE_I64) {
34 v = (float) *(const int64_t *) &data[i];
35 } else if (type == GGML_TYPE_I32) {
36 v = (float) *(const int32_t *) &data[i];
37 } else if (type == GGML_TYPE_I16) {
38 v = (float) *(const int16_t *) &data[i];
39 } else if (type == GGML_TYPE_I8) {
40 v = (float) *(const int8_t *) &data[i];
41 } else if (type == GGML_TYPE_BF16) {
42 v = ggml_bf16_to_fp32(*(const ggml_bf16_t *) &data[i]);
43 } else {
44 GGML_ABORT("fatal error");
45 }
46 return v;
47}
48
49#define INDENT " "
50

Callers 1

Calls 2

ggml_fp16_to_fp32Function · 0.85
ggml_bf16_to_fp32Function · 0.85

Tested by

no test coverage detected