Skip to content

Commit

Permalink
Fix (tests): adapt tests to new logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed Nov 13, 2023
1 parent 3e6920a commit ba1fe22
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion tests/brevitas/core/test_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@ def test_interval_percentile(self):
out = interval_percentile(values)

range = self.compute_percentile(values, low_q=0.01, high_q=99.9)
expected_out = torch.abs(range[1] - range[0])
# Clamp is to make sure the lower bound is not positive to align with zero-point statistics
low_result = torch.clamp(range[0], max=torch.tensor(0.0))
expected_out = torch.abs(range[1] - low_result)
assert torch.allclose(out, expected_out)
2 changes: 1 addition & 1 deletion tests/brevitas/fx/test_tracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,4 +238,4 @@ def test_quant_module(module):
out = mod(x)
graph_model = value_trace(mod, value_args={'x': x_trace})
graph_out = graph_model(x)
assert graph_out.value.isclose(out.value).all().item()
assert graph_out.isclose(out).all().item()

0 comments on commit ba1fe22

Please sign in to comment.