Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed Dec 30, 2024
1 parent e4d25a0 commit e330cab
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/brevitas/proxy/test_proxy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import pytest
import torch

from brevitas.nn import QuantLinear
from brevitas.nn.quant_activation import QuantReLU
Expand Down Expand Up @@ -80,3 +81,11 @@ def test_dynamic_act_proxy(self):

model.act_quant.disable_quant = True
assert model.act_quant.bit_width() is None

def test_delay_act_proxy(self):
model = QuantReLU(quant_delay_steps=1)
inp = torch.randn(1, 5)
o = model(inp)
assert torch.allclose(inp, o)
o = model(inp)
assert not torch.allclose(inp, o)

0 comments on commit e330cab

Please sign in to comment.