| 23 | { |
| 24 | |
| 25 | void PercentileComputer::update_qparam( |
| 26 | const std::unordered_map<const luci::CircleNode *, MinMaxVectors> *minmax_map) |
| 27 | { |
| 28 | if (minmax_map == nullptr) |
| 29 | throw std::invalid_argument("minmax_map is nullptr"); |
| 30 | |
| 31 | for (auto iter = minmax_map->begin(); iter != minmax_map->end(); ++iter) |
| 32 | { |
| 33 | auto node = iter->first; |
| 34 | auto minmax = iter->second; |
| 35 | |
| 36 | auto min = getNthPercentile(minmax.min_vector, _min_percentile); |
| 37 | auto max = getNthPercentile(minmax.max_vector, _max_percentile); |
| 38 | |
| 39 | auto quantparam = std::make_unique<luci::CircleQuantParam>(); |
| 40 | quantparam->min.push_back(min); |
| 41 | quantparam->max.push_back(max); |
| 42 | |
| 43 | assert(node->quantparam() == nullptr); |
| 44 | |
| 45 | auto mutable_node = const_cast<luci::CircleNode *>(node); |
| 46 | mutable_node->quantparam(std::move(quantparam)); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | void MovingAvgComputer::update_qparam( |
| 51 | const std::unordered_map<const luci::CircleNode *, MinMaxVectors> *minmax_map) |