Check if a layer is included/excluded by command line
| 70 | |
| 71 | // Check if a layer is included/excluded by command line |
| 72 | static bool layer_included(const quantize_stats_params & params, const std::string & layer) { |
| 73 | for (const auto& excluded : params.exclude_layers) { |
| 74 | if (std::regex_search(layer, std::regex(excluded))) { |
| 75 | return false; |
| 76 | } |
| 77 | } |
| 78 | for (const auto& included : params.include_layers) { |
| 79 | if (std::regex_search(layer, std::regex(included))) { |
| 80 | return true; |
| 81 | } |
| 82 | } |
| 83 | return params.include_layers.empty(); |
| 84 | } |
| 85 | |
| 86 | // Update error statistics given vectors with the before/after result of quantization |
| 87 | static void update_error_stats(int64_t nelements, const float * input, const float * output, error_stats & stats) { |