Skip to content

Commit

Permalink
Fix (nn): correct bias handlind in ScaleBias
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed Mar 31, 2023
1 parent 6835332 commit 5001efc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/brevitas/nn/quant_scale_bias.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ def __init__(self, num_features: int, bias: bool, runtime_shape=(1, -1, 1, 1)):
self.runtime_shape = runtime_shape

def forward(self, input):
return input * self.weight.view(self.runtime_shape) + self.bias.view(self.runtime_shape)
out = input * self.weight.view(self.runtime_shape)
if self.bias:
out += self.bias.view(self.runtime_shape)
return out


class QuantScaleBias(QuantWBIOL, ScaleBias):
Expand Down

0 comments on commit 5001efc

Please sign in to comment.