| 586 | } |
| 587 | |
| 588 | torch::Tensor code1x8_dequant( |
| 589 | const torch::Tensor& codes, |
| 590 | const torch::Tensor& codebooks, |
| 591 | const torch::Tensor& scales |
| 592 | ) { |
| 593 | auto use_bfloat16 = check_use_bfloat16(codebooks); |
| 594 | auto in_features = codes.size(1) * 8; |
| 595 | auto out_features = scales.size(0); |
| 596 | |
| 597 | auto weight = torch::empty({out_features, in_features}, |
| 598 | torch::TensorOptions() |
| 599 | .dtype(codebooks.dtype()) |
| 600 | .device(codebooks.device()) |
| 601 | ); |
| 602 | code1x8_dequant_cuda( |
| 603 | codes.data_ptr(), |
| 604 | weight.data_ptr(), |
| 605 | codebooks.data_ptr(), |
| 606 | out_features, |
| 607 | in_features, |
| 608 | use_bfloat16 |
| 609 | ); |
| 610 | weight *= scales.index({"...", 0, 0}); |
| 611 | |
| 612 | return weight; |
| 613 | } |
| 614 | |
| 615 | torch::Tensor code1x8_matmat_dequant( |
| 616 | const torch::Tensor& input, |
nothing calls this directly
no test coverage detected