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

Function gguf_find_tensor

external/ggml/src/gguf.cpp:1027–1041  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1025}
1026
1027int64_t gguf_find_tensor(const struct gguf_context * ctx, const char * name) {
1028 // return -1 if tensor not found
1029 int64_t tensor_id = -1;
1030
1031 const int64_t n_tensors = gguf_get_n_tensors(ctx);
1032
1033 for (int64_t i = 0; i < n_tensors; ++i) {
1034 if (strcmp(name, gguf_get_tensor_name(ctx, i)) == 0) {
1035 tensor_id = i;
1036 break;
1037 }
1038 }
1039
1040 return tensor_id;
1041}
1042
1043size_t gguf_get_tensor_offset(const struct gguf_context * ctx, int64_t tensor_id) {
1044 GGML_ASSERT(tensor_id >= 0 && tensor_id < gguf_get_n_tensors(ctx));

Callers 3

gguf_add_tensorFunction · 0.85
gguf_set_tensor_typeFunction · 0.85
gguf_set_tensor_dataFunction · 0.85

Calls 2

gguf_get_n_tensorsFunction · 0.85
gguf_get_tensor_nameFunction · 0.85

Tested by

no test coverage detected