Skip to content

Commit

Permalink
add forward-onnly backends for debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
mobicham committed Mar 18, 2024
1 parent 9e7249e commit 4a95c9e
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hqq/core/quantize.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,10 @@ class HQQBackend(Enum):
PYTORCH_BACKPROP_COMPILE = "forward_pytorch_backprop_compile"
ATEN_BACKPROP = "forward_aten_backprop"

PYTORCH_FORWARD = "forward_pytorch"
PYTORCH_FORWARD_COMPILE = "forward_pytorch_compile"
ATEN_FORWARD = "forward_aten"


# No cache: less memory, slower
class HQQMatmulNoCacheDeq(torch.autograd.Function):
Expand Down Expand Up @@ -779,6 +783,7 @@ def forward_aten(self, x: Tensor) -> Tensor:
out = torch.matmul(x, W_est.t())
if self.bias is not None:
out += self.bias

return out

def forward_aten_backprop(self, x: Tensor) -> Tensor:
Expand Down

0 comments on commit 4a95c9e

Please sign in to comment.