@@ -599,6 +599,7 @@ struct gguf_context * gguf_init_from_file_impl(FILE * file, struct gguf_init_par
599599 }
600600 const size_t type_size = ggml_type_size (info.t .type );
601601 const int64_t blck_size = ggml_blck_size (info.t .type );
602+ // const int64_t row_size = ggml_row_size(info.t.type, info.t.ne[0]);
602603
603604 // check that row size is divisible by block size
604605 if (blck_size == 0 || info.t .ne [0 ] % blck_size != 0 ) {
@@ -611,6 +612,7 @@ struct gguf_context * gguf_init_from_file_impl(FILE * file, struct gguf_init_par
611612
612613 // calculate byte offsets given the tensor shape and type
613614 info.t .nb [0 ] = type_size;
615+ // info.t.nb[1] = info.t.nb[0]*(info.t.ne[0]/blck_size);
614616 info.t .nb [1 ] = ggml_row_size (info.t .type , info.t .ne [0 ]);
615617 for (int j = 2 ; j < GGML_MAX_DIMS; ++j) {
616618 info.t .nb [j] = info.t .nb [j - 1 ]*info.t .ne [j - 1 ];
@@ -1162,7 +1164,9 @@ void gguf_set_tensor_type(struct gguf_context * ctx, const char * name, enum ggm
11621164 GGML_ASSERT (tensor->ne [0 ] % blck_size == 0 && " tensor row size not divisible by block size of new type" );
11631165
11641166 tensor->nb [0 ] = type_size;
1165- tensor->nb [1 ] = tensor->nb [0 ]*(tensor->ne [0 ]/blck_size);
1167+ // tensor->nb[1] = tensor->nb[0]*(tensor->ne[0]/blck_size);
1168+ tensor->nb [1 ] = ggml_row_size (type, tensor->ne [0 ]);
1169+
11661170 for (int i = 2 ; i < GGML_MAX_DIMS; i++) {
11671171 tensor->nb [i] = tensor->nb [i - 1 ]*tensor->ne [i - 1 ];
11681172 }
0 commit comments