We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b864f15 commit 58851b5Copy full SHA for 58851b5
ggml_extend.hpp
@@ -1311,12 +1311,12 @@ class Linear : public UnaryBlock {
1311
1312
auto ne = x->ne[0];
1313
auto im = ggml_mul_mat(ctx, x, w);
1314
-
1315
- auto empty = ggml_new_tensor_1d(ctx, GGML_TYPE_F32, ne);
1316
- auto eyev = ggml_set_f32(empty, 1.0f);
1317
- auto eye = ggml_diag(ctx, eyev);
1318
- auto imm = ggml_mul_mat(ctx, im, eye);
1319
- auto ims = ggml_sum_rows(ctx, imm);
+
+ auto a = ggml_diag_mask_zero(ctx, im, 0);
+ auto b = ggml_transpose(ctx, a);
+ auto c = ggml_diag_mask_zero(ctx, b, 0);
+ auto d = ggml_transpose(ctx, c);
+ auto ims = ggml_sum_rows(ctx, d);
1320
auto imv = ggml_reshape_1d(ctx, ims, ne);
1321
1322
//
0 commit comments