MCPcopy
hub / github.com/deepspeedai/DeepSpeed / run_float_dequantize

Function run_float_dequantize

tests/unit/ops/quantizer/test_quantize.py:107–120  ·  view source on GitHub ↗
(q_bits, is_symmetric_quant, data_i8, params, num_groups)

Source from the content-addressed store, hash-verified

105
106
107def run_float_dequantize(q_bits, is_symmetric_quant, data_i8, params, num_groups):
108 data_f = data_i8.reshape(num_groups, -1).to(dtype=torch.float32)
109
110 scales = params[:, 0].reshape(-1, 1)
111 offsets = params[:, 1].reshape(-1, 1)
112
113 if not is_symmetric_quant:
114 data_f = data_f - offsets
115 else:
116 assert offsets.allclose(torch.zeros_like(offsets))
117
118 data_f = data_f * scales
119
120 return data_f
121
122
123@pytest.mark.inference_ops

Callers 1

test_float_quantizeFunction · 0.85

Calls 2

toMethod · 0.45
reshapeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…