Skip to content

Commit

Permalink
[change] Disabled round-to even in RequantShift nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Xeratec committed Feb 2, 2023
1 parent 39816e8 commit e8cfc0d
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions algorithms/pact/pact_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,9 @@ def forward(ctx, x, mul, add, div, signed, n_levels_out, cmsis_requant):
# PULP-NN performs multiplication first, then addition and
# division. Division is with flooring.
else:
try:
y = x * mul + add
y = (y/div).floor()
except Exception as e:
print(e)
import IPython; IPython.embed()
y = x * mul + add
# Avoid round to even behaviour, friggin pytorch
y = torch.floor((y / div) + 0.5)

if not signed:
# if unsigned: clip y to interval (0, n_levels-1)
Expand Down

0 comments on commit e8cfc0d

Please sign in to comment.