Skip to content

Commit bb6edb1

Browse files
committed
using matmul for no bias
1 parent 819b234 commit bb6edb1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fastdeploy/model_executor/layers/linear.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ def apply(self, layer: nn.Layer, x: paddle.Tensor) -> paddle.Tensor:
8888
f"bias must be 1D with size equal to the last dim of weight, "
8989
f"but got bias.shape={bias.shape}, weight.shape[-1]={layer.weight.shape[-1]}"
9090
)
91+
out = paddle.nn.functional.linear(x, layer.weight, bias)
9192
else:
92-
bias = None
93+
out = paddle.matmul(x, layer.weight)
9394

94-
out = paddle.nn.functional.linear(x, layer.weight, bias)
9595
return out
9696

9797

0 commit comments

Comments
 (0)