Skip to content

Commit 9e01433

Browse files
authored
Update ggml_extend.hpp
1 parent ecd6617 commit 9e01433

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ggml_extend.hpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,12 @@ class Linear : public UnaryBlock {
13101310
}
13111311

13121312
auto im = ggml_mul_mat(ctx, x, w);
1313-
auto imv = ggml_diag(ctx, im);
1313+
auto empty = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, im.ne[0]);
1314+
auto eyev = ggml_set_f32(eye, 1.0f);
1315+
auto eye = ggml_diag(ctx, eyev);
1316+
auto imm = ggml_mul_mat(ctx, im, eye);
1317+
auto ims = ggml_sum_rows(ctx, imm);
1318+
auto imv = ggml_reshape_1d(ctx, ims, im.ne[0]);
13141319

13151320
//
13161321
print_ggml_tensor(x, true, "imatrix x");

0 commit comments

Comments
 (0)