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 May 3, 2023
1 parent 7f83831 commit acb5eda
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 acb5eda

Please sign in to comment.