MCPcopy Create free account
hub / github.com/Vahe1994/AQLM / code1x8_dequant

Function code1x8_dequant

inference_lib/src/aqlm/inference_kernels/cuda_kernel.cpp:588–613  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

586}
587
588torch::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
615torch::Tensor code1x8_matmat_dequant(
616 const torch::Tensor& input,

Callers

nothing calls this directly

Calls 1

check_use_bfloat16Function · 0.85

Tested by

no test coverage detected