| 435 | } |
| 436 | |
| 437 | void ParseControlFlowErrors(std::set<string>* custom_ops, |
| 438 | std::vector<string>* error_msgs) { |
| 439 | std::set<string> unsupported_control_flow_ops; |
| 440 | // Check if unsupported ops contains control flow ops. It's impossible |
| 441 | // to implement these ops as custom ops at the moment. |
| 442 | for (const auto& op : *custom_ops) { |
| 443 | if (IsControlFlowOp(op)) { |
| 444 | unsupported_control_flow_ops.insert(op); |
| 445 | } |
| 446 | } |
| 447 | if (!unsupported_control_flow_ops.empty()) { |
| 448 | error_msgs->push_back(absl::StrCat( |
| 449 | "TensorFlow Lite currently doesn't support control flow ops: ", |
| 450 | absl::StrJoin(unsupported_control_flow_ops, ", "), ".", |
| 451 | " We are working on supporting control flow ops, please see github " |
| 452 | "issue at " |
| 453 | "https://github.com/tensorflow/tensorflow/issues/28485.")); |
| 454 | } |
| 455 | // Remove control flow ops from `custom_ops` set so that they won't be |
| 456 | // reported again in later messages. |
| 457 | for (const auto& op : unsupported_control_flow_ops) { |
| 458 | custom_ops->erase(op); |
| 459 | } |
| 460 | } |
| 461 | |
| 462 | // Exports a string buffer that contains the model's minimum required runtime |
| 463 | // version. |