Skip to content

Commit

Permalink
fix for multiple inits
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed Jan 6, 2025
1 parent 9146d5b commit b45f298
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/brevitas/core/scaling/standalone.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,9 +376,10 @@ def __init__(
self.restrict_threshold_pre = restrict_threshold_impl.restrict_init_module()

def init_scale(self):
self.restrict_inplace_preprocess(self.buffer)
inplace_tensor_mul(self.value.detach(), self.buffer)
self.counter = self.counter + 1
if self.counter <= self.collect_stats_steps:
self.restrict_inplace_preprocess(self.buffer)
inplace_tensor_mul(self.value.detach(), self.buffer)
self.counter = self.collect_stats_steps + 1

@brevitas.jit.script_method
def training_forward(self, stats_input: Tensor, threshold: Tensor) -> Tensor:
Expand Down

0 comments on commit b45f298

Please sign in to comment.