MCPcopy Create free account
hub / github.com/ROCm/AMDMIGraphX / quantize_fp16

Function quantize_fp16

src/quantization.cpp:68–76  ·  view source on GitHub ↗

This function is to convert any instructions specified in the input from double or float to float16 by inserting a convert operator. For the conversion, there could be cases of overflowing or underflowing, but it is uncommon. Run optimize_module() before converting to fp16 to const eval and fold in FP32 to avoid loss of precision.

Source from the content-addressed store, hash-verified

66// is uncommon. Run optimize_module() before converting to fp16 to const eval and fold in FP32 to
67// avoid loss of precision.
68void quantize_fp16(program& prog, const std::vector<std::string>& ins_names)
69{
70 run_passes(prog,
71 {normalize_ops{},
72 optimize_module{{"quantizelinear", "dequantizelinear"}},
73 truncate_float_pass{ins_names, shape::half_type},
74 optimize_module{{"quantizelinear", "dequantizelinear"}}},
75 quant_tracer());
76}
77
78void quantize_bf16(program& prog, const std::vector<std::string>& ins_names)
79{

Callers 9

TEST_CASEFunction · 0.50
create_programMethod · 0.50
create_programMethod · 0.50
create_programMethod · 0.50
create_programMethod · 0.50
TEST_CASEFunction · 0.50
TEST_CASEFunction · 0.50
mainFunction · 0.50

Calls 2

run_passesFunction · 0.85
quant_tracerFunction · 0.85

Tested by 5

create_programMethod · 0.40
create_programMethod · 0.40
create_programMethod · 0.40
create_programMethod · 0.40
TEST_CASEFunction · 0.40