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

Function all_tensors_in_other

subprojects/llama.cpp/tests/test-gguf.cpp:1017–1044  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1015}
1016
1017static bool all_tensors_in_other(const gguf_context * ctx, const gguf_context * other) {
1018 bool ok = true;
1019
1020 const int n_tensors = gguf_get_n_tensors(ctx);
1021 for (int id = 0; id < n_tensors; ++id) {
1022 const std::string name = gguf_get_tensor_name(ctx, id);
1023
1024 const int idx_other = gguf_find_tensor(other, name.c_str());
1025 if (id != idx_other) {
1026 ok = false;
1027 if (idx_other < 0) {
1028 continue;
1029 }
1030 }
1031
1032 const ggml_type type = gguf_get_tensor_type(ctx, id);
1033 if (type != gguf_get_tensor_type(other, id)) {
1034 ok = false;
1035 }
1036
1037 const size_t offset = gguf_get_tensor_offset(ctx, id);
1038 if (offset != gguf_get_tensor_offset(other, id)) {
1039 ok = false;
1040 }
1041 }
1042
1043 return ok;
1044}
1045
1046static bool same_tensor_data(const struct ggml_context * orig, const struct ggml_context * read) {
1047 bool ok = true;

Callers 1

test_roundtripFunction · 0.85

Calls 5

gguf_get_n_tensorsFunction · 0.85
gguf_get_tensor_nameFunction · 0.85
gguf_find_tensorFunction · 0.85
gguf_get_tensor_typeFunction · 0.85
gguf_get_tensor_offsetFunction · 0.85

Tested by

no test coverage detected