MCPcopy Create free account
hub / github.com/ml-explore/mlx / dispatch_quantize_dequantize

Function dispatch_quantize_dequantize

mlx/backend/cpu/quantized.cpp:1131–1146  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1129}
1130
1131void dispatch_quantize_dequantize(
1132 const array& w,
1133 array& out,
1134 int bits,
1135 int group_size) {
1136 if (w.dtype() == float16) {
1137 fp_quantize_dequantize<float16_t>(w, out, bits, group_size, w.size());
1138 } else if (w.dtype() == bfloat16) {
1139 fp_quantize_dequantize<bfloat16_t>(w, out, bits, group_size, w.size());
1140 } else if (w.dtype() == float32) {
1141 fp_quantize_dequantize<float>(w, out, bits, group_size, w.size());
1142 } else {
1143 throw std::runtime_error(
1144 "[quantize_dequantize] Only supports floating point inputs");
1145 }
1146}
1147
1148template <typename T, typename U>
1149void quantize(

Callers 1

eval_cpuMethod · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected