| 189 | } |
| 190 | |
| 191 | void LoadOperatorsMap( |
| 192 | const Model& model, OperatorsMap* operators_map, |
| 193 | const std::map<OperatorType, std::unique_ptr<BaseOperator>>& ops_by_type, |
| 194 | bool enable_select_tf_ops) { |
| 195 | // First find a list of unique operator types. |
| 196 | std::set<OperatorKey> keys; |
| 197 | for (const auto& op : model.operators) { |
| 198 | const toco::OperatorSignature op_signature = {op.get(), &model}; |
| 199 | keys.insert(OperatorKey(op_signature, ops_by_type, enable_select_tf_ops)); |
| 200 | } |
| 201 | // Now assign indices to them and fill in the map. |
| 202 | int index = 0; |
| 203 | for (const auto& key : keys) { |
| 204 | (*operators_map)[key] = index; |
| 205 | ++index; |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | } // namespace details |
| 210 | |