@@ -599,6 +599,7 @@ struct gguf_context * gguf_init_from_file_impl(FILE * file, struct gguf_init_par
599
599
}
600
600
const size_t type_size = ggml_type_size (info.t .type );
601
601
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]);
602
603
603
604
// check that row size is divisible by block size
604
605
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
611
612
612
613
// calculate byte offsets given the tensor shape and type
613
614
info.t .nb [0 ] = type_size;
615
+ // info.t.nb[1] = info.t.nb[0]*(info.t.ne[0]/blck_size);
614
616
info.t .nb [1 ] = ggml_row_size (info.t .type , info.t .ne [0 ]);
615
617
for (int j = 2 ; j < GGML_MAX_DIMS; ++j) {
616
618
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
1162
1164
GGML_ASSERT (tensor->ne [0 ] % blck_size == 0 && " tensor row size not divisible by block size of new type" );
1163
1165
1164
1166
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
+
1166
1170
for (int i = 2 ; i < GGML_MAX_DIMS; i++) {
1167
1171
tensor->nb [i] = tensor->nb [i - 1 ]*tensor->ne [i - 1 ];
1168
1172
}
0 commit comments