MCPcopy Create free account
hub / github.com/Tiiny-AI/PowerInfer / gguf_set_tensor_data

Function gguf_set_tensor_data

ggml.c:20177–20190  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20175}
20176
20177void gguf_set_tensor_data(struct gguf_context * ctx, const char * name, const void * data, size_t size) {
20178 const int idx = gguf_find_tensor(ctx, name);
20179 if (idx < 0) {
20180 GGML_ASSERT(false && "tensor not found");
20181 }
20182
20183 ctx->infos[idx].data = data;
20184 ctx->infos[idx].size = size;
20185
20186 // update offsets
20187 for (uint32_t i = idx + 1; i < ctx->header.n_tensors; ++i) {
20188 ctx->infos[i].offset = ctx->infos[i - 1].offset + GGML_PAD(ctx->infos[i - 1].size, ctx->alignment);
20189 }
20190}
20191
20192//static void gguf_fwrite_str(FILE * file, const struct gguf_str * val) {
20193// fwrite(&val->n, sizeof(val->n), 1, file);

Callers 2

clip_model_quantizeFunction · 0.50

Calls 1

gguf_find_tensorFunction · 0.70

Tested by

no test coverage detected