MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / gguf_set_arr_data

Function gguf_set_arr_data

subprojects/llama.cpp/ggml/src/gguf.cpp:1049–1060  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1047}
1048
1049void gguf_set_arr_data(struct gguf_context * ctx, const char * key, enum gguf_type type, const void * data, size_t n) {
1050 gguf_check_reserved_keys(key, data);
1051 gguf_remove_key(ctx, key);
1052
1053 const size_t nbytes = n*gguf_type_size(type);
1054 std::vector<int8_t> tmp(nbytes);
1055 if (!tmp.empty()) {
1056 memcpy(tmp.data(), data, nbytes);
1057 }
1058 ctx->kv.emplace_back(key, tmp);
1059 ctx->kv.back().cast(type);
1060}
1061
1062void gguf_set_arr_str(struct gguf_context * ctx, const char * key, const char ** data, size_t n) {
1063 gguf_check_reserved_keys(key, data);

Callers 3

add_kvMethod · 0.85
get_random_gguf_contextFunction · 0.85
gguf_set_kvFunction · 0.85

Calls 6

gguf_check_reserved_keysFunction · 0.85
gguf_remove_keyFunction · 0.85
gguf_type_sizeFunction · 0.85
emptyMethod · 0.65
dataMethod · 0.45
castMethod · 0.45

Tested by 1

get_random_gguf_contextFunction · 0.68