Skip to content

Commit

Permalink
Fix (export/trunc): Retrieve bit_width from cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nickfraser committed Jan 28, 2025
1 parent e9de9d4 commit 5a41cfb
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions src/brevitas/proxy/runtime_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,7 @@ def zero_point(self):
return self.retrieve_attribute('zero_point')

def bit_width(self):
if not self.is_quant_enabled:
return None
zhs = self._zero_hw_sentinel()
# Signed might or might not be defined. We just care about retrieving the bitwidth
empty_imp = IntQuantTensor(zhs, zhs, zhs, zhs, signed=True, training=self.training)
bit_width = self.__call__(empty_imp).bit_width
return bit_width
return self.retrieve_attribute('bit_width')

def forward(self, x: IntQuantTensor) -> Union[Tensor, IntQuantTensor]:
if self.is_quant_enabled:
Expand Down

0 comments on commit 5a41cfb

Please sign in to comment.