1// RUN: tf-mlir-translate -mlir-to-graphdef %s -o - | FileCheck %s 2 3"module"() ( { 4 "func"() ( { 5 "tf_executor.graph"() ( { 6 %outputs, %control = "tf_executor.island"() ( { 7 %0 = "tf.Const"() {device = "", value = dense<0> : tensor<i32>} : () -> tensor<i32> 8 "tf_executor.yield"(%0) : (tensor<i32>) -> () 9 }) : () -> (tensor<i32>, !tf_executor.control) 10 %outputs_0:3, %control_1 = "tf_executor._SwitchN"(%outputs, %outputs) {T = i32, device = "", num_outs = 3 : i64} : (tensor<i32>, tensor<i32>) -> (tensor<*xi32>, tensor<*xi32>, tensor<*xi32>, !tf_executor.control) 11 %outputs_2, %control_3 = "tf_executor.island"() ( { 12 %0 = "tf.Identity"(%outputs_0#0) {device = ""} : (tensor<*xi32>) -> tensor<*xi32> 13 "tf_executor.yield"(%0) : (tensor<*xi32>) -> () 14 }) : () -> (tensor<*xi32>, !tf_executor.control) 15 %outputs_4, %control_5 = "tf_executor.island"(%control_3) ( { 16 %0 = "tf.Const"() {device = "", value = dense<2.000000e+00> : tensor<f32>} : () -> tensor<f32> 17 "tf_executor.yield"(%0) : (tensor<f32>) -> () 18 }) : (!tf_executor.control) -> (tensor<f32>, !tf_executor.control) 19 %outputs_6, %control_7 = "tf_executor.island"() ( { 20 %0 = "tf.Identity"(%outputs_0#1) {device = ""} : (tensor<*xi32>) -> tensor<*xi32> 21 "tf_executor.yield"(%0) : (tensor<*xi32>) -> () 22 }) : () -> (tensor<*xi32>, !tf_executor.control) 23 %outputs_8, %control_9 = "tf_executor.island"(%control_7) ( { 24 %0 = "tf.Const"() {device = "", value = dense<3.000000e+00> : tensor<f32>} : () -> tensor<f32> 25 "tf_executor.yield"(%0) : (tensor<f32>) -> () 26 }) : (!tf_executor.control) -> (tensor<f32>, !tf_executor.control) 27 %outputs_10, %control_11 = "tf_executor.island"() ( { 28 %0 = "tf.Identity"(%outputs_0#2) {device = ""} : (tensor<*xi32>) -> tensor<*xi32> 29 "tf_executor.yield"(%0) : (tensor<*xi32>) -> () 30 }) : () -> (tensor<*xi32>, !tf_executor.control) 31 %outputs_12, %control_13 = "tf_executor.island"(%control_11) ( { 32 %0 = "tf.Const"() {device = "", value = dense<4.000000e+00> : tensor<f32>} : () -> tensor<f32> 33 "tf_executor.yield"(%0) : (tensor<f32>) -> () 34 }) : (!tf_executor.control) -> (tensor<f32>, !tf_executor.control) 35 %outputs_14, %control_15 = "tf_executor.island"() ( { 36 %0 = "tf.Const"() {device = "", value = dense<1.000000e+00> : tensor<f32>} : () -> tensor<f32> 37 "tf_executor.yield"(%0) : (tensor<f32>) -> () 38 }) : () -> (tensor<f32>, !tf_executor.control) 39 %outputs_16:2, %control_17 = "tf_executor._SwitchN"(%outputs_14, %outputs) {T = f32, _class = ["Case/input_0"], device = "", num_outs = 2 : i64} : (tensor<f32>, tensor<i32>) -> (tensor<*xf32>, tensor<*xf32>, !tf_executor.control) 40 %outputs_18, %control_19 = "tf_executor.island"() ( { 41 %0 = "tf.Mul"(%outputs_16#0, %outputs_4) {device = ""} : (tensor<*xf32>, tensor<f32>) -> tensor<*xf32> 42 "tf_executor.yield"(%0) : (tensor<*xf32>) -> () 43 }) : () -> (tensor<*xf32>, !tf_executor.control) 44 %outputs_20, %control_21 = "tf_executor.island"() ( { 45 %0 = "tf.Mul"(%outputs_16#1, %outputs_8) {device = ""} : (tensor<*xf32>, tensor<f32>) -> tensor<*xf32> 46 "tf_executor.yield"(%0) : (tensor<*xf32>) -> () 47 }) : () -> (tensor<*xf32>, !tf_executor.control) 48 %output, %value_index, %control_22 = "tf_executor.Merge"(%outputs_18, %outputs_20) {N = 2 : i64, T = f32, device = ""} : (tensor<*xf32>, tensor<*xf32>) -> (tensor<*xf32>, tensor<*xi32>, !tf_executor.control) 49 %control_23 = "tf_executor.island"() ( { 50 "tf._Retval"(%output) {T = f32, device = "/job:localhost/replica:0/task:0/device:CPU:0", index = 0 : i64} : (tensor<*xf32>) -> () 51 "tf_executor.yield"() : () -> () 52 }) : () -> !tf_executor.control 53 "tf_executor.fetch"() : () -> () 54 }) : () -> () 55 "std.return"() : () -> () 56 }) {sym_name = "main", type = () -> ()} : () -> () 57 "module_terminator"() : () -> () 58}) {tf.versions = {bad_consumers = [], min_consumer = 0 : i32, producer = 126 : i32}} : () -> () 59 60// CHECK: _SwitchN 61