Skip to content

Commit

Permalink
Export: remove torch dynamic qdq
Browse files Browse the repository at this point in the history
  • Loading branch information
Giuseppe5 committed Jan 18, 2024
1 parent 186ca19 commit 2b2a085
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions src/brevitas/export/torch/qcdq/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
from brevitas.export.common.handler.qcdq import DQCastMixin
from brevitas.export.common.handler.qcdq import QCDQCastActQuantProxyHandlerMixin
from brevitas.export.common.handler.qcdq import QCDQCastTruncQuantProxyHandlerMixin
from brevitas.export.common.handler.qcdq import DynamicQDQActQuantProxyHandlerMixin
from brevitas.export.common.handler.qcdq import QMixin


Expand Down Expand Up @@ -90,29 +89,6 @@ def quantize_fn(self, x, scale, zero_point, dtype, axis):
return y.int_repr()


class TorchDynamicQDQCastMixin(QMixin, TorchDQCastMixin, ABC):

@classmethod
def int8_dtype(cls):
return torch.qint8

@classmethod
def uint8_dtype(cls):
return torch.quint8

@classmethod
def int32_dtype(cls):
return torch.qint32

def validate(self, module):
super().validate(module)
self.validate_8b_bit_width(module.bit_width(), le_then=False)
assert module.rounding_mode.upper() == 'ROUND', 'Only round to nearest even supported'

def quantize_fn(self, x, scale, zero_point, dtype, axis):
raise RuntimeError("Currently there is no representation for Dynamic Quantization in Torch")


class TorchQCDQHandler(BaseHandler):

def forward(self, *args, **kwargs):
Expand Down Expand Up @@ -158,12 +134,6 @@ def int_clip_symbolic_kwargs(cls, narrow, signed, bit_width):
return _itemize_clip_bounds(clip_args)


class StdDynamicQDQCastONNXActQuantProxyHandler(TorchDynamicQDQCastMixin,
DynamicQDQActQuantProxyHandlerMixin,
TorchQCDQHandler):
pass


class TorchCDQCastBiasQuantProxyHandler(TorchDQCastMixin,
CDQCastBiasQuantProxyHandlerMixin,
TorchQCDQHandler):
Expand Down

0 comments on commit 2b2a085

Please sign in to comment.