(
A: Tensor,
B: Tensor,
out: Optional[torch.Tensor] = None,
transposed_A=False,
transposed_B=False,
state=None,
)
| 1298 | |
| 1299 | |
| 1300 | def gemv_4bit( |
| 1301 | A: Tensor, |
| 1302 | B: Tensor, |
| 1303 | out: Optional[torch.Tensor] = None, |
| 1304 | transposed_A=False, |
| 1305 | transposed_B=False, |
| 1306 | state=None, |
| 1307 | ): |
| 1308 | if state is None: |
| 1309 | raise ValueError("state cannot be None. gemv_4bit() requires the state from quantize_4bit()") |
| 1310 | |
| 1311 | absmax = state.absmax |
| 1312 | if state.nested: |
| 1313 | absmax = dequantize_blockwise(absmax, state.state2) + state.offset |
| 1314 | |
| 1315 | if out is not None: |
| 1316 | torch.ops.bitsandbytes.gemv_4bit.out( |
| 1317 | A, |
| 1318 | B, |
| 1319 | state.shape, |
| 1320 | absmax, |
| 1321 | state.code, |
| 1322 | state.blocksize, |
| 1323 | out=out, |
| 1324 | ) |
| 1325 | return out |
| 1326 | |
| 1327 | return torch.ops.bitsandbytes.gemv_4bit.default( |
| 1328 | A, |
| 1329 | B, |
| 1330 | state.shape, |
| 1331 | absmax, |
| 1332 | state.code, |
| 1333 | state.blocksize, |
| 1334 | ) |
| 1335 | |
| 1336 | |
| 1337 | @deprecated("This function is deprecated and will be removed in a future release.", category=FutureWarning) |
nothing calls this directly
no test coverage detected