Check if a TensorFlow Op is a control flow op by its name.
| 53 | |
| 54 | // Check if a TensorFlow Op is a control flow op by its name. |
| 55 | bool IsControlFlowOp(const string& tensorflow_op) { |
| 56 | // Technically this is equalivent to `::tensorflow::Node::IsControlFlow()`. |
| 57 | // It requires to construct a `::tensorflow::Graph` to use that helper |
| 58 | // function, so we simply hardcode the list of control flow ops here. |
| 59 | if (tensorflow_op == "Switch" || tensorflow_op == "RefSwitch" || |
| 60 | tensorflow_op == "Merge" || tensorflow_op == "RefMerge" || |
| 61 | tensorflow_op == "Enter" || tensorflow_op == "RefEnter" || |
| 62 | tensorflow_op == "Exit" || tensorflow_op == "RefExit" || |
| 63 | tensorflow_op == "NextIteration" || tensorflow_op == "RefNextIteration") { |
| 64 | return true; |
| 65 | } |
| 66 | // TODO(ycling): Also check how to handle Variable ops and Assign ops. |
| 67 | return false; |
| 68 | } |
| 69 | |
| 70 | // Check if a TensorFlow Op is unsupported by the Flex runtime. |
| 71 | bool IsUnsupportedFlexOp(const string& tensorflow_op) { |
no outgoing calls
no test coverage detected