Skip to content

Commit b370209

Browse files
Modified 'post_round' function condition (#23)
1 parent b31bf2c commit b370209

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/pquant/core/keras/layers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1347,11 +1347,12 @@ def call(self, x, training=None):
13471347

13481348

13491349
def call_post_round_functions(model, rewind, rounds, r):
1350+
last_round = (r == rounds - 1)
13501351
if rewind == "round":
13511352
rewind_weights_functions(model)
1352-
elif rewind == "post-ticket-search" and r == rounds - 1:
1353+
elif rewind == "post-ticket-search" and last_round:
13531354
rewind_weights_functions(model)
1354-
else:
1355+
elif not last_round:
13551356
post_round_functions(model)
13561357

13571358

src/pquant/core/torch/layers.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,11 +1404,12 @@ def apply_final_compression(module):
14041404

14051405

14061406
def call_post_round_functions(model, rewind, rounds, r):
1407+
last_round = (r == rounds - 1)
14071408
if rewind == "round":
14081409
rewind_weights_functions(model)
1409-
elif rewind == "post-ticket-search" and r == rounds - 1:
1410+
elif rewind == "post-ticket-search" and last_round:
14101411
rewind_weights_functions(model)
1411-
elif r != rounds - 1:
1412+
elif not last_round:
14121413
post_round_functions(model)
14131414

14141415

0 commit comments

Comments
 (0)