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

Function remove_zero_point

src/simplify_qdq.cpp:574–594  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

572};
573
574void remove_zero_point(module& m)
575{
576 for(auto ins : iterator_for(m))
577 {
578 if(ins->name() != "dequantizelinear")
579 continue;
580 if(ins->inputs().size() != 3)
581 continue;
582 auto zp = ins->inputs().at(2);
583 if(not zp->can_eval())
584 continue;
585 auto a = zp->eval();
586 bool is_zero = false;
587 a.visit([&](auto t) {
588 is_zero = std::all_of(t.begin(), t.end(), [](auto x) { return float_equal(x, 0); });
589 });
590 if(not is_zero)
591 continue;
592 m.replace_instruction(ins, ins->get_operator(), ins->inputs().at(0), ins->inputs().at(1));
593 }
594}
595
596void add_int4_pack_unpack_pair(module& m)
597{

Callers 1

applyMethod · 0.85

Calls 13

iterator_forFunction · 0.85
atMethod · 0.80
can_evalMethod · 0.80
replace_instructionMethod · 0.80
all_ofFunction · 0.50
float_equalFunction · 0.50
nameMethod · 0.45
sizeMethod · 0.45
inputsMethod · 0.45
evalMethod · 0.45
visitMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected