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

Function gguf_find_tensor

ggml.c:19952–19966  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19950}
19951
19952int gguf_find_tensor(const struct gguf_context * ctx, const char * name) {
19953 // return -1 if tensor not found
19954 int tensorfound = -1;
19955
19956 const int n_tensors = gguf_get_n_tensors(ctx);
19957
19958 for (int i = 0; i < n_tensors; ++i) {
19959 if (strcmp(name, gguf_get_tensor_name(ctx, i)) == 0) {
19960 tensorfound = i;
19961 break;
19962 }
19963 }
19964
19965 return tensorfound;
19966}
19967
19968size_t gguf_get_tensor_offset(const struct gguf_context * ctx, int i) {
19969 return ctx->infos[i].offset;

Callers 6

gguf_set_tensor_typeFunction · 0.70
gguf_set_tensor_dataFunction · 0.70
file_offsetMethod · 0.70
llm_load_tensorsFunction · 0.70

Calls 2

gguf_get_n_tensorsFunction · 0.70
gguf_get_tensor_nameFunction · 0.70

Tested by

no test coverage detected