summaryrefslogtreecommitdiff
path: root/bitsandbytes/autograd
diff options
context:
space:
mode:
authorjustheuristic <justheuristic@gmail.com>2022-09-18 00:24:20 +0300
committerjustheuristic <justheuristic@gmail.com>2022-09-18 00:24:20 +0300
commit14048a3c16bf3e60754b4218ec40a01e6a7f213c (patch)
treebaf4dde5cfb84d15ecc256dff5d2e135e98ed9f9 /bitsandbytes/autograd
parent5b169f18e4894a82b8681139727d45a4dd61c4b1 (diff)
safer cast
Diffstat (limited to 'bitsandbytes/autograd')
-rw-r--r--bitsandbytes/autograd/_functions.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/bitsandbytes/autograd/_functions.py b/bitsandbytes/autograd/_functions.py
index 93304f9..6a225b7 100644
--- a/bitsandbytes/autograd/_functions.py
+++ b/bitsandbytes/autograd/_functions.py
@@ -371,7 +371,7 @@ class MatMul8bitLt(torch.autograd.Function):
gradB32, SgradB32 = F.igemmlt(C32grad, CxAt, Sgrad, SAt)
grad_B = F.mm_dequant(gradB32, SgradB32, SCgradt, SCAt).to(ctx.dtype_B)
if state.threshold > 0.0 and subA is not None:
- grad_B[:, idx].addmm_(grad_output.t(), subA)
+ grad_B[:, idx] += torch.mm(grad_output.t(), subA)
if req_gradA:
if state.CBt is not None:
@@ -384,6 +384,7 @@ class MatMul8bitLt(torch.autograd.Function):
grad_A = F.mm_dequant(gradA32, SgradA32, SCgrad, state.SCBt).view(ctx.grad_shape).to(ctx.dtype_A)
elif state.CB is not None:
+ raise NotImplementedError("WIP")
CB = state.CB.to(ctx.dtype_B)
CB.mul_(state.SCB.unsqueeze(1).div_(127.0).to(CB.dtype))
grad_A = torch.matmul(grad_output, CB).view(ctx.grad_shape).to(ctx.dtype_A)