blob: fb915eeea38e4bde0c9236de147cb2b9302817a3 [file] [log] [blame]
# RUN: tf-mlir-translate -graphdef-to-mlir -tf-enable-shape-inference-on-import=true %s -o - | FileCheck %s --dump-input-on-failure
# TODO(jpienaar): No op's shape gets inferred without shape inference
# enabled, so will remove this test when the import options gets removed.
# Verify that the _output_shapes attribute of ReadVariableOp's are used to get
# variable types.
# This also checks that the output type is correctly inferred based on
# that.
# CHECK: func @__inference_some_function_130(%arg0: tensor<*x!tf.resource>) -> tensor<f32>
# CHECK: tf.ReadVariableOp"(%arg0) {{.*}} : (tensor<*x!tf.resource>) -> tensor<f32>
node {
name : "Variable"
op : "VarHandleOp"
attr {
key : "shape"
value {
shape {
}
}
}
attr {
key : "dtype"
value {
type : DT_FLOAT
}
}
attr {
key : "shared_name"
value {
s: "Variable"
}
}
attr {
key : "_output_shapes"
value {
list {
shape {
}
}
}
}
}
node {
name : "StatefulPartitionedCall"
op : "StatefulPartitionedCall"
input : [ "Variable" ]
attr {
key : "f"
value {
func {
name: "__inference_some_function_13"
}
}
}
attr {
key : "config_proto"
value {
s: "\n\x07\n\x03GPU\x10\x00\n\x07\n\x03\x43PU\x10\x01\x32\x02J\x00\x38\x01"
}
}
attr {
key : "Tout"
value {
list {
type : [ DT_FLOAT ]
}
}
}
attr {
key : "_gradient_op_type"
value {
s: "PartitionedCall-29"
}
}
attr {
key : "_output_shapes"
value {
list {
shape {
}
}
}
}
attr {
key : "Tin"
value {
list {
type : [ DT_RESOURCE ]
}
}
}
}
library {
function {
signature {
name: "__inference_some_function_13"
input_arg {
name : "readvariableop_resource"
type : DT_RESOURCE
}
output_arg {
name : "identity"
type : DT_FLOAT
}
is_stateful : true
control_output: [ "ReadVariableOp" ]
}
node_def {
name : "ReadVariableOp"
op : "ReadVariableOp"
input : [ "readvariableop_resource" ]
device: "/job:localhost/replica:0/task:0/device:CPU:0"
attr {
key : "dtype"
value {
type : DT_FLOAT
}
}
attr {
key : "_output_shapes"
value {
list {
shape {
}
}
}
}
}
node_def {
name : "Identity"
op : "Identity"
input : [ "ReadVariableOp:value:0", "^ReadVariableOp" ]
attr {
key : "T"
value {
type : DT_FLOAT
}
}
attr {
key : "_output_shapes"
value {
list {
shape {
}
}
}
}
}
ret {
key : "identity"
value: "Identity:output:0"
}
attr {
key : "_input_shapes"
value {
list {
shape {
unknown_rank: true
}
}
}
}
control_ret {
key : "ReadVariableOp"
value: "ReadVariableOp"
}
arg_attr {
key : 0x00000000
value {
}
}
}
}
versions {
producer : 148
min_consumer : 12
}