| 1080 | } |
| 1081 | |
| 1082 | void CheckOperatorOrdering(const Model& model) { |
| 1083 | std::unordered_set<string> arrays_behind_us; |
| 1084 | for (const auto& array_entry : model.GetArrayMap()) { |
| 1085 | if (!GetOpWithOutput(model, array_entry.first)) { |
| 1086 | arrays_behind_us.insert(array_entry.first); |
| 1087 | } |
| 1088 | } |
| 1089 | arrays_behind_us.insert(model.optional_arrays.begin(), |
| 1090 | model.optional_arrays.end()); |
| 1091 | for (const auto& op : model.operators) { |
| 1092 | for (const auto& input : op->inputs) { |
| 1093 | if (!IsConstantParameterArray(model, input)) { |
| 1094 | CHECK(arrays_behind_us.count(input)); |
| 1095 | } |
| 1096 | } |
| 1097 | for (const auto& output : op->outputs) { |
| 1098 | CHECK(!arrays_behind_us.count(output)); |
| 1099 | arrays_behind_us.insert(output); |
| 1100 | } |
| 1101 | } |
| 1102 | for (const string& output_array : model.flags.output_arrays()) { |
| 1103 | CHECK(arrays_behind_us.count(output_array)); |
| 1104 | } |
| 1105 | } |
| 1106 | |
| 1107 | void FixOperatorOrdering(Model* model) { |
| 1108 | std::unordered_set<string> arrays_behind_us; |
no test coverage detected