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

Function gguf_add_tensor

external/ggml/src/gguf.cpp:1234–1247  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1232}
1233
1234void gguf_add_tensor(
1235 struct gguf_context * ctx,
1236 const struct ggml_tensor * tensor) {
1237 GGML_ASSERT(tensor);
1238 if (gguf_find_tensor(ctx, tensor->name) != -1) {
1239 GGML_ABORT("duplicate tensor name: %s", tensor->name);
1240 }
1241
1242 struct gguf_tensor_info ti;
1243 ti.t = *tensor;
1244 ti.offset = ctx->info.empty() ? 0 :
1245 ctx->info.back().offset + GGML_PAD(ggml_nbytes(&ctx->info.back().t), ctx->alignment);
1246 ctx->info.push_back(ti);
1247}
1248
1249void gguf_set_tensor_type(struct gguf_context * ctx, const char * name, enum ggml_type type) {
1250 const int64_t tensor_id = gguf_find_tensor(ctx, name);

Callers 1

mnist_model_saveFunction · 0.85

Calls 3

gguf_find_tensorFunction · 0.85
ggml_nbytesFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected