File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -1300,12 +1300,25 @@ class Linear : public UnaryBlock {
13001300 if (bias) {
13011301 b = params[" bias" ];
13021302 }
1303- auto act = ggml_nn_linear (ctx, x, w, NULL );
1303+
1304+ struct ggml_tensor * act = NULL ;
1305+ struct ggml_tensor * out = NULL ;
1306+
1307+ act = ggml_mul_mat (ctx, w, x);
1308+ if (b != NULL ) {
1309+ out = ggml_add (ctx, act, b);
1310+ }
1311+
1312+ auto im = ggml_mul_mat (ctx, x, w);
1313+ auto imv = ggml_diag (im);
1314+
13041315 //
13051316 print_ggml_tensor (x, true , " imatrix x" );
13061317 print_ggml_tensor (w, true , " imatrix w" );
13071318 print_ggml_tensor (act, true , " imatrix act" );
1308- return ggml_nn_linear (ctx, x, w, b);
1319+ print_ggml_tensor (im, true , " imatrix im" );
1320+ print_ggml_tensor (imv, true , " imatrix imv" );
1321+ return out == NULL ? act : out;
13091322 }
13101323};
13111324
You can’t perform that action at this time.
0 commit comments