| 19950 | } |
| 19951 | |
| 19952 | int 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 | |
| 19968 | size_t gguf_get_tensor_offset(const struct gguf_context * ctx, int i) { |
| 19969 | return ctx->infos[i].offset; |
no test coverage detected