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

Function gguf_find_tensor

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

Source from the content-addressed store, hash-verified

919}
920
921int64_t gguf_find_tensor(const struct gguf_context * ctx, const char * name) {
922 // return -1 if tensor not found
923 int64_t tensor_id = -1;
924
925 const int64_t n_tensors = gguf_get_n_tensors(ctx);
926
927 for (int64_t i = 0; i < n_tensors; ++i) {
928 if (strcmp(name, gguf_get_tensor_name(ctx, i)) == 0) {
929 tensor_id = i;
930 break;
931 }
932 }
933
934 return tensor_id;
935}
936
937size_t gguf_get_tensor_offset(const struct gguf_context * ctx, int64_t tensor_id) {
938 GGML_ASSERT(tensor_id >= 0 && tensor_id < gguf_get_n_tensors(ctx));

Callers 12

read_tensor_dataMethod · 0.85
writeMethod · 0.85
llama_tensor_weightMethod · 0.85
add_tensorMethod · 0.85
all_tensors_in_otherFunction · 0.85
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 3

all_tensors_in_otherFunction · 0.68