| 1015 | } |
| 1016 | |
| 1017 | static 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 | |
| 1046 | static bool same_tensor_data(const struct ggml_context * orig, const struct ggml_context * read) { |
| 1047 | bool ok = true; |
no test coverage detected