| # RUN: tf-mlir-translate -graphdef-to-mlir %s -tf-input-arrays=input -tf-input-data-types=DT_INT32 -tf-input-shapes='' -tf-output-arrays=while:2 -o - | FileCheck %s |
| |
| # This check that we don't error out when importing GraphDef containing |
| # functions with arg name that are the same as the graph input name |
| |
| # CHECK: func @main(%arg0: tensor<i32>) -> tensor<i32> |
| # CHECK: func @while_body |
| # CHECK: func @while_cond |
| |
| node { |
| name: "input" |
| op: "Placeholder" |
| attr { |
| key: "_user_specified_name" |
| value { |
| s: "input" |
| } |
| } |
| attr { |
| key: "dtype" |
| value { |
| type: DT_INT32 |
| } |
| } |
| attr { |
| key: "shape" |
| value { |
| shape { |
| } |
| } |
| } |
| } |
| node { |
| name: "while/maximum_iterations" |
| op: "Const" |
| attr { |
| key: "dtype" |
| value { |
| type: DT_INT32 |
| } |
| } |
| attr { |
| key: "value" |
| value { |
| tensor { |
| dtype: DT_INT32 |
| tensor_shape { |
| } |
| int_val: -1 |
| } |
| } |
| } |
| } |
| node { |
| name: "while/loop_counter" |
| op: "Const" |
| attr { |
| key: "dtype" |
| value { |
| type: DT_INT32 |
| } |
| } |
| attr { |
| key: "value" |
| value { |
| tensor { |
| dtype: DT_INT32 |
| tensor_shape { |
| } |
| int_val: 0 |
| } |
| } |
| } |
| } |
| node { |
| name: "while" |
| op: "While" |
| input: "while/loop_counter" |
| input: "while/maximum_iterations" |
| input: "input" |
| attr { |
| key: "T" |
| value { |
| list { |
| type: DT_INT32 |
| type: DT_INT32 |
| type: DT_INT32 |
| } |
| } |
| } |
| attr { |
| key: "_lower_using_switch_merge" |
| value { |
| b: true |
| } |
| } |
| attr { |
| key: "body" |
| value { |
| func { |
| name: "while_body_6" |
| } |
| } |
| } |
| attr { |
| key: "cond" |
| value { |
| func { |
| name: "while_cond_5" |
| } |
| } |
| } |
| attr { |
| key: "output_shapes" |
| value { |
| list { |
| shape { |
| } |
| shape { |
| } |
| shape { |
| } |
| } |
| } |
| } |
| attr { |
| key: "parallel_iterations" |
| value { |
| i: 10 |
| } |
| } |
| } |
| library { |
| function { |
| signature { |
| name: "while_body_6" |
| input_arg { |
| name: "while_loop_counter" |
| type: DT_INT32 |
| } |
| input_arg { |
| name: "while_maximum_iterations" |
| type: DT_INT32 |
| } |
| input_arg { |
| name: "input" |
| type: DT_INT32 |
| } |
| output_arg { |
| name: "output" |
| type: DT_INT32 |
| } |
| output_arg { |
| name: "output_1" |
| type: DT_INT32 |
| } |
| output_arg { |
| name: "output_2" |
| type: DT_INT32 |
| } |
| } |
| node_def { |
| name: "Add/y" |
| op: "Const" |
| attr { |
| key: "dtype" |
| value { |
| type: DT_INT32 |
| } |
| } |
| attr { |
| key: "value" |
| value { |
| tensor { |
| dtype: DT_INT32 |
| tensor_shape { |
| } |
| int_val: 1 |
| } |
| } |
| } |
| } |
| node_def { |
| name: "Add" |
| op: "Add" |
| input: "input" |
| input: "Add/y:output:0" |
| attr { |
| key: "T" |
| value { |
| type: DT_INT32 |
| } |
| } |
| } |
| node_def { |
| name: "add_1/y" |
| op: "Const" |
| attr { |
| key: "dtype" |
| value { |
| type: DT_INT32 |
| } |
| } |
| attr { |
| key: "value" |
| value { |
| tensor { |
| dtype: DT_INT32 |
| tensor_shape { |
| } |
| int_val: 1 |
| } |
| } |
| } |
| } |
| node_def { |
| name: "add_1" |
| op: "Add" |
| input: "while_loop_counter" |
| input: "add_1/y:output:0" |
| attr { |
| key: "T" |
| value { |
| type: DT_INT32 |
| } |
| } |
| } |
| ret { |
| key: "output" |
| value: "add_1:z:0" |
| } |
| ret { |
| key: "output_1" |
| value: "while_maximum_iterations" |
| } |
| ret { |
| key: "output_2" |
| value: "Add:z:0" |
| } |
| } |
| function { |
| signature { |
| name: "while_cond_5" |
| input_arg { |
| name: "while_loop_counter" |
| type: DT_INT32 |
| } |
| input_arg { |
| name: "while_maximum_iterations" |
| type: DT_INT32 |
| } |
| input_arg { |
| name: "input" |
| type: DT_INT32 |
| } |
| output_arg { |
| name: "identity" |
| type: DT_BOOL |
| } |
| } |
| node_def { |
| name: "Less/y" |
| op: "Const" |
| attr { |
| key: "dtype" |
| value { |
| type: DT_INT32 |
| } |
| } |
| attr { |
| key: "value" |
| value { |
| tensor { |
| dtype: DT_INT32 |
| tensor_shape { |
| } |
| int_val: 10 |
| } |
| } |
| } |
| } |
| node_def { |
| name: "Less" |
| op: "Less" |
| input: "input" |
| input: "Less/y:output:0" |
| attr { |
| key: "T" |
| value { |
| type: DT_INT32 |
| } |
| } |
| } |
| ret { |
| key: "identity" |
| value: "Less:z:0" |
| } |
| } |
| } |
| versions { |
| producer: 27 |
| min_consumer: 12 |
| } |
| |