From 2c22e3bcdb25d718761a2c2e69ef1dd894f747fa Mon Sep 17 00:00:00 2001 From: klosax <131523366+klosax@users.noreply.github.com> Date: Sat, 29 Jul 2023 20:37:47 +0200 Subject: [PATCH] ggml.c : get arr str and f32 --- ggml.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ggml.c b/ggml.c index d402daa67..af3a9ce71 100644 --- a/ggml.c +++ b/ggml.c @@ -18768,6 +18768,16 @@ enum gguf_type gguf_get_type(struct gguf_context * ctx, int i) { return ctx->header.kv[i].type; } +const char * gguf_get_arr_str(struct gguf_context * ctx, int key_id, int i) { + struct gguf_kv * kv = &ctx->header.kv[key_id]; + struct gguf_str * str = &((struct gguf_str *) kv->value.arr.data)[i]; + return str->data; +} + +float gguf_get_arr_f32(struct gguf_context * ctx, int key_id, int i) { + return ((float *) ctx->header.kv[key_id].value.arr.data)[i]; +} + uint8_t gguf_get_val_u8(struct gguf_context * ctx, int i) { return ctx->header.kv[i].value.uint8; }