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

Function gguf_add_tensor

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

Source from the content-addressed store, hash-verified

1126}
1127
1128void gguf_add_tensor(
1129 struct gguf_context * ctx,
1130 const struct ggml_tensor * tensor) {
1131 GGML_ASSERT(tensor);
1132 if (gguf_find_tensor(ctx, tensor->name) != -1) {
1133 GGML_ABORT("duplicate tensor name: %s", tensor->name);
1134 }
1135
1136 struct gguf_tensor_info ti;
1137 ti.t = *tensor;
1138 ti.offset = ctx->info.empty() ? 0 :
1139 ctx->info.back().offset + GGML_PAD(ggml_nbytes(&ctx->info.back().t), ctx->alignment);
1140 ctx->info.push_back(ti);
1141}
1142
1143void gguf_set_tensor_type(struct gguf_context * ctx, const char * name, enum ggml_type type) {
1144 const int64_t tensor_id = gguf_find_tensor(ctx, name);

Callers 8

export_ggufFunction · 0.85
run_mergeMethod · 0.85
split_strategyMethod · 0.85
gguf_mergeFunction · 0.85
save_imatrixMethod · 0.85
add_tensorMethod · 0.85
get_random_gguf_contextFunction · 0.85

Calls 4

gguf_find_tensorFunction · 0.85
ggml_nbytesFunction · 0.85
emptyMethod · 0.65
push_backMethod · 0.45

Tested by 1

get_random_gguf_contextFunction · 0.68