Browse Source

fix(mge/functional): reshape bias to (1, out_features) in linear

GitOrigin-RevId: a15880b7fc
release-0.5
Megvii Engine Team Xu Xinran 5 years ago
parent
commit
0d8b913682
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      python_module/megengine/functional/nn.py

+ 1
- 1
python_module/megengine/functional/nn.py View File

@@ -44,7 +44,7 @@ def linear(inp: Tensor, weight: Tensor, bias: Optional[Tensor] = None) -> Tensor
ret = mgb.opr.matrix_mul(inp, weight, transposeB=True)
ret = ret.reshape(orig_shape[:-1], weight.shape[0])
if bias is not None:
ret += bias
ret += bias.reshape(1, bias.shape[0])
return ret




Loading…
Cancel
Save