Skip to content

Commit

Permalink
Fix for sigmoid init
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed Nov 16, 2023
1 parent 86c5d16 commit 2593d32
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/brevitas/nn/quant_activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@
from .quant_layer import QuantNonLinearActLayer as QuantNLAL


# Starting from Torch 2.0, nn.Module init function accepts custom *args and **kwargs
# torch.nn.Sigmoid does not provide its own init method, and the presence of *args + **kwargs
# conflicts with the dependency injection package
class Sigmoid(nn.Sigmoid):

def __init__(self):
super().__init__()


class QuantReLU(QuantNLAL):

def __init__(
Expand Down Expand Up @@ -41,7 +50,7 @@ def __init__(
**kwargs):
QuantNLAL.__init__(
self,
act_impl=nn.Sigmoid,
act_impl=Sigmoid,
passthrough_act=False,
input_quant=input_quant,
act_quant=act_quant,
Expand Down

0 comments on commit 2593d32

Please sign in to comment.