--- /dev/null
+# conv2d with VALID, stride = 1, 1
+input, ifm:0, TF_FLOAT, [1, 5, 5, 3]
+output, maxpool:0, TF_FLOAT, [1, 4, 4, 2]
--- /dev/null
+# Small Conv2D-MaxPool network
+node {
+ name: "ifm"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim { size: 1 }
+ dim { size: 5 }
+ dim { size: 5 }
+ dim { size: 3 }
+ }
+ }
+ }
+}
+node {
+ name: "ker"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim { size: 2 }
+ dim { size: 2 }
+ dim { size: 3 }
+ dim { size: 2 }
+ }
+ float_val: 1.1
+ }
+ }
+ }
+}
+node {
+ name: "ofm"
+ op: "Conv2D"
+ input: "ifm"
+ input: "ker"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
+node {
+ name: "maxpool"
+ op: "MaxPool"
+ input: "ofm"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "ksize"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
--- /dev/null
+input, in:0, TF_FLOAT, [1, 5, 5, 3]
+output, out:0, TF_FLOAT, [1, 4, 4, 5]
--- /dev/null
+# Small Conv2D-BiasAdd-Conv2D network
+node {
+ name: "in"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim { size: 1 } # N
+ dim { size: 5 } # H
+ dim { size: 5 } # W
+ dim { size: 3 } # C
+ }
+ }
+ }
+}
+node {
+ name: "ker"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim { size: 2 } # H
+ dim { size: 2 } # W
+ dim { size: 3 } # I
+ dim { size: 2 } # O
+ }
+ float_val: 1.1
+ }
+ }
+ }
+}
+node {
+ name: "conv"
+ op: "Conv2D"
+ input: "in"
+ input: "ker"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
+node {
+ name: "bias"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim { size: 2 }
+ }
+ float_val: 1.1
+ }
+ }
+ }
+}
+node {
+ name: "badd"
+ op: "BiasAdd"
+ input: "conv"
+ input: "bias"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+}
+node {
+ name: "ker1"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim { size: 1 } # H
+ dim { size: 1 } # W
+ dim { size: 2 } # I
+ dim { size: 5 } # O
+ }
+ float_val: 1.1
+ }
+ }
+ }
+}
+node {
+ name: "out"
+ op: "Conv2D"
+ input: "badd"
+ input: "ker1"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
--- /dev/null
+input, in:0, TF_FLOAT, [1, 5, 5, 3]
+output, out:0, TF_FLOAT, [1, 4, 4, 5]
--- /dev/null
+# Small Conv2D-ReLU-Conv2D network
+node {
+ name: "in"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim { size: 1 } # N
+ dim { size: 5 } # H
+ dim { size: 5 } # W
+ dim { size: 3 } # C
+ }
+ }
+ }
+}
+node {
+ name: "ker"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim { size: 2 } # H
+ dim { size: 2 } # W
+ dim { size: 3 } # I
+ dim { size: 2 } # O
+ }
+ float_val: 1.1
+ }
+ }
+ }
+}
+node {
+ name: "conv"
+ op: "Conv2D"
+ input: "in"
+ input: "ker"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
+node {
+ name: "relu"
+ op: "Relu"
+ input: "conv"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+}
+node {
+ name: "ker1"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim { size: 1 } # H
+ dim { size: 1 } # W
+ dim { size: 2 } # I
+ dim { size: 5 } # O
+ }
+ float_val: 1.1
+ }
+ }
+ }
+}
+node {
+ name: "out"
+ op: "Conv2D"
+ input: "relu"
+ input: "ker1"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [1, 3, 3, 5]
+output, FusedBatchNorm:0, TF_FLOAT, [1, 3, 3, 1]
--- /dev/null
+# Small Conv2D + FusedBatchNorm network
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim {
+ size: 1 # N
+ }
+ dim {
+ size: 3 # H
+ }
+ dim {
+ size: 3 # W
+ }
+ dim {
+ size: 5 # C
+ }
+ }
+ }
+ }
+}
+node {
+ name: "Const"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2 # H
+ }
+ dim {
+ size: 2 # W
+ }
+ dim {
+ size: 5 # I
+ }
+ dim {
+ size: 1 # O
+ }
+ }
+ float_val: 1.0
+ }
+ }
+ }
+}
+node {
+ name: "Conv2D"
+ op: "Conv2D"
+ input: "Placeholder"
+ input: "Const"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "padding"
+ value {
+ s: "SAME"
+ }
+ }
+ attr {
+ key: "strides"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "use_cudnn_on_gpu"
+ value {
+ b: true
+ }
+ }
+}
+node {
+ name: "scale"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 1
+ }
+ }
+ float_val: 1.0
+ }
+ }
+ }
+}
+node {
+ name: "offset"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 1
+ }
+ }
+ float_val: 0.0
+ }
+ }
+ }
+}
+node {
+ name: "FusedBatchNorm/mean"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 1
+ }
+ }
+ float_val: 0.0
+ }
+ }
+ }
+}
+node {
+ name: "FusedBatchNorm/variance"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 1
+ }
+ }
+ float_val: 1.0
+ }
+ }
+ }
+}
+node {
+ name: "FusedBatchNorm"
+ op: "FusedBatchNorm"
+ input: "Conv2D"
+ input: "scale"
+ input: "offset"
+ input: "FusedBatchNorm/mean"
+ input: "FusedBatchNorm/variance"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+ attr {
+ key: "epsilon"
+ value {
+ f: 0.0010000000474974513
+ }
+ }
+ attr {
+ key: "is_training"
+ value {
+ b: false
+ }
+ }
+}
--- /dev/null
+# TF_SMALL_NET_0003/test.pbtxt is create with below script
+
+# Version info
+# - Tensorflow : 1.13.1
+# - Python : 3.5.2
+
+import tensorflow as tf
+
+input0 = tf.placeholder(tf.float32, [1, 3, 3, 5])
+filter0 = tf.constant(1.0, shape=[2, 2, 5, 1])
+conv = tf.nn.conv2d(input0, filter=filter0, strides=[1, 1, 1, 1], padding='SAME')
+fbn = tf.nn.fused_batch_norm(
+ conv, scale=[1.0], offset=[0.0], mean=[0.0], variance=[1.0], is_training=False)
+
+print(tf.get_default_graph().as_graph_def())
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [1, 3, 3, 5]
+output, FusedBatchNorm:0, TF_FLOAT, [1, 3, 3, 10]
--- /dev/null
+# Small DepthwiseConv2D + FusedBatchNorm network
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 5
+ }
+ }
+ }
+ }
+}
+node {
+ name: "Const"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ dim {
+ size: 2
+ }
+ dim {
+ size: 5
+ }
+ dim {
+ size: 2
+ }
+ }
+ float_val: 1
+ }
+ }
+ }
+}
+node {
+ name: "depthwise/Shape"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_INT32
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape {
+ dim {
+ size: 4
+ }
+ }
+ int_val: 2
+ int_val: 2
+ int_val: 5
+ int_val: 2
+ }
+ }
+ }
+}
+node {
+ name: "depthwise/dilation_rate"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_INT32
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ int_val: 1
+ int_val: 1
+ }
+ }
+ }
+}
+node {
+ name: "depthwise"
+ op: "DepthwiseConv2dNative"
+ input: "Placeholder"
+ input: "Const"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "padding"
+ value {
+ s: "SAME"
+ }
+ }
+ attr {
+ key: "strides"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+}
+node {
+ name: "Const_1"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 10
+ }
+ }
+ float_val: 2
+ }
+ }
+ }
+}
+node {
+ name: "FusedBatchNorm"
+ op: "FusedBatchNorm"
+ input: "depthwise"
+ input: "Const_1"
+ input: "Const_1"
+ input: "Const_1"
+ input: "Const_1"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+ attr {
+ key: "epsilon"
+ value {
+ f: 0.001
+ }
+ }
+ attr {
+ key: "is_training"
+ value {
+ b: false
+ }
+ }
+}
--- /dev/null
+# TF_SMALL_NET_0004/test.pbtxt is create with below script
+
+# Version info
+# - Tensorflow : 1.13.1
+# - Python : 3.5.2
+
+import tensorflow as tf
+
+input0 = tf.placeholder(tf.float32, [1, 3, 3, 5])
+filter0 = tf.constant(1.0, shape=[2, 2, 5, 2])
+dconv = tf.nn.depthwise_conv2d(input0, filter0, [1, 1, 1, 1], 'SAME')
+const = tf.constant(2.0, shape=[10])
+fbn = tf.nn.fused_batch_norm(
+ x=dconv, scale=const, offset=const, mean=const, variance=const, is_training=False)
+
+print(tf.get_default_graph().as_graph_def())
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [1, 2, 3, 2]
+output, Reshape2:0, TF_FLOAT, [1, 2, 3, 2]
--- /dev/null
+# Small Shape + Reshape network
+# This test is quite similar with the last part of InceptionV3
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 2
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+}
+node {
+ name: "Shape"
+ op: "Shape"
+ input: "Placeholder"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "out_type"
+ value {
+ type: DT_INT32
+ }
+ }
+}
+node {
+ name: "Const"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_INT32
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ int_val: 3
+ int_val: 4
+ }
+ }
+ }
+}
+node {
+ name: "Reshape1"
+ op: "Reshape"
+ input: "Placeholder"
+ input: "Const"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "Tshape"
+ value {
+ type: DT_INT32
+ }
+ }
+}
+node {
+ name: "Relu"
+ op: "Relu"
+ input: "Reshape1"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
+node {
+ name: "Reshape2"
+ op: "Reshape"
+ input: "Relu"
+ input: "Shape"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "Tshape"
+ value {
+ type: DT_INT32
+ }
+ }
+}
--- /dev/null
+input, placeholder:0, TF_FLOAT, [1, 7, 7, 1]
+output, maxpool:0, TF_FLOAT, [1, 7, 7, 2]
--- /dev/null
+# A simple network that has "Concat" in between feature operations.
+#
+# Placeholder -+-> MaxPool2D -+-> Concat -> MaxPool2D
+# | |
+# +-> MaxPool2D -+
+#
+node {
+ name: "placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim { size: 1 } # N
+ dim { size: 7 } # H
+ dim { size: 7 } # W
+ dim { size: 1 } # C
+ }
+ }
+ }
+}
+node {
+ name: "maxpool_1"
+ op: "MaxPool"
+ input: "placeholder"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "ksize"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
+node {
+ name: "maxpool_2"
+ op: "MaxPool"
+ input: "placeholder"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "ksize"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
+node {
+ name: "axis"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_INT32 }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape { }
+ int_val: 3
+ }
+ }
+ }
+}
+node {
+ name: "concat"
+ op: "ConcatV2"
+ input: "maxpool_1"
+ input: "maxpool_2"
+ input: "axis"
+ attr {
+ key: "N"
+ value { i: 2 }
+ }
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "Tidx"
+ value { type: DT_INT32 }
+ }
+}
+node {
+ name: "maxpool"
+ op: "MaxPool"
+ input: "concat"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "data_format"
+ value { s: "NHWC" }
+ }
+ attr {
+ key: "ksize"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+ attr {
+ key: "padding"
+ value { s: "VALID" }
+ }
+ attr {
+ key: "strides"
+ value {
+ list { i: 1 i: 1 i: 1 i: 1 }
+ }
+ }
+}
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [1, 3, 3, 5]
+output, Mul:0, TF_FLOAT, [1, 3, 3, 2]
--- /dev/null
+# A simple network that has "Conv2D" + "Mul"
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 5
+ }
+ }
+ }
+ }
+}
+node {
+ name: "weights"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ dim {
+ size: 2
+ }
+ dim {
+ size: 5
+ }
+ dim {
+ size: 2
+ }
+ }
+ float_val: 1.100000023841858
+ }
+ }
+ }
+}
+node {
+ name: "Conv2D"
+ op: "Conv2D"
+ input: "Placeholder"
+ input: "weights"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "padding"
+ value {
+ s: "SAME"
+ }
+ }
+ attr {
+ key: "strides"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "use_cudnn_on_gpu"
+ value {
+ b: true
+ }
+ }
+}
+node {
+ name: "mulparam"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ float_val: 2.0
+ }
+ }
+ }
+}
+node {
+ name: "Mul"
+ op: "Mul"
+ input: "Conv2D"
+ input: "mulparam"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [1, 3, 3, 5]
+output, Add:0, TF_FLOAT, [1, 3, 3, 2]
--- /dev/null
+# A simple network that has "Conv2D" + "Add"
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 5
+ }
+ }
+ }
+ }
+}
+node {
+ name: "weights"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ dim {
+ size: 2
+ }
+ dim {
+ size: 5
+ }
+ dim {
+ size: 2
+ }
+ }
+ float_val: 1.100000023841858
+ }
+ }
+ }
+}
+node {
+ name: "Conv2D"
+ op: "Conv2D"
+ input: "Placeholder"
+ input: "weights"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "padding"
+ value {
+ s: "SAME"
+ }
+ }
+ attr {
+ key: "strides"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "use_cudnn_on_gpu"
+ value {
+ b: true
+ }
+ }
+}
+node {
+ name: "addparam"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ float_val: 2.0
+ }
+ }
+ }
+}
+node {
+ name: "Add"
+ op: "Add"
+ input: "Conv2D"
+ input: "addparam"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [1, 3, 3, 5]
+output, Add:0, TF_FLOAT, [1, 3, 3, 2]
--- /dev/null
+# A simple network that has "Conv2D" + "BiasAdd" + "Add"
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 5
+ }
+ }
+ }
+ }
+}
+node {
+ name: "weights"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ dim {
+ size: 2
+ }
+ dim {
+ size: 5
+ }
+ dim {
+ size: 2
+ }
+ }
+ float_val: 1.100000023841858
+ }
+ }
+ }
+}
+node {
+ name: "Conv2D"
+ op: "Conv2D"
+ input: "Placeholder"
+ input: "weights"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+ attr {
+ key: "dilations"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "padding"
+ value {
+ s: "SAME"
+ }
+ }
+ attr {
+ key: "strides"
+ value {
+ list {
+ i: 1
+ i: 1
+ i: 1
+ i: 1
+ }
+ }
+ }
+ attr {
+ key: "use_cudnn_on_gpu"
+ value {
+ b: true
+ }
+ }
+}
+node {
+ name: "BiasAdd/bias"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ float_val: 1.0
+ float_val: 1.0
+ }
+ }
+ }
+}
+node {
+ name: "BiasAdd"
+ op: "BiasAdd"
+ input: "Conv2D"
+ input: "BiasAdd/bias"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+}
+node {
+ name: "addparam"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ float_val: 2.0
+ }
+ }
+ }
+}
+node {
+ name: "Add"
+ op: "Add"
+ input: "BiasAdd"
+ input: "addparam"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [1, 3, 3, 2]
+output, Add:0, TF_FLOAT, [1, 3, 3, 2]
--- /dev/null
+# A simple network that has "BiasAdd" + "Add"
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim {
+ size: 1
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 3
+ }
+ dim {
+ size: 2
+ }
+ }
+ }
+ }
+}
+node {
+ name: "bias_add_01/bias"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ float_val: 1.0
+ float_val: -1.0
+ }
+ }
+ }
+}
+node {
+ name: "bias_add_01"
+ op: "BiasAdd"
+ input: "Placeholder"
+ input: "bias_add_01/bias"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "data_format"
+ value {
+ s: "NHWC"
+ }
+ }
+}
+node {
+ name: "addparam"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ }
+ float_val: 2.0
+ }
+ }
+ }
+}
+node {
+ name: "Add"
+ op: "Add"
+ input: "bias_add_01"
+ input: "addparam"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
--- /dev/null
+input, placeholder:0, TF_FLOAT, [2]
+output, concat_out:0, TF_FLOAT, [6]
--- /dev/null
+# A simple network that includes constant foldable subgraph
+# (note: [] indicates shape, () indicates real value)
+#
+# input1 (const) -- relu -+ placeholder --+
+# (-1, 1) (0, 1) | shape [2] |
+# | |
+# input2 (const) -+-- concat -------- concat_out
+# (2, 3) | (0, 1, 2, 3) |
+# | |
+# axis (const)-+-------------------+
+#
+# will be the following after constant folding:
+#
+# Pull --+
+# shape [2] |
+# |
+# ConstGen------- TensorConcat -- Push
+# (0, 1, 2, 3) shape [6]
+#
+node {
+ name: "input1"
+ op: "Const"
+ attr {
+ key: "dtype" value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape { dim { size: 2 } }
+ float_val: -1
+ float_val: 1
+ }
+ }
+ }
+}
+node {
+ name: "relu"
+ op: "Relu"
+ input: "input1"
+ attr { key: "T" value { type: DT_FLOAT } }
+}
+node {
+ name: "input2"
+ op: "Const"
+ attr {
+ key: "dtype" value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape { dim { size: 2 } }
+ float_val: 2
+ float_val: 3
+ }
+ }
+ }
+}
+node {
+ name: "axis"
+ op: "Const"
+ attr { key: "dtype" value { type: DT_INT32 } }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape { }
+ int_val: 0
+ }
+ }
+ }
+}
+node {
+ name: "concat"
+ op: "ConcatV2"
+ input: "relu"
+ input: "input2"
+ input: "axis"
+ attr {
+ key: "N"
+ value { i: 2 }
+ }
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "Tidx"
+ value { type: DT_INT32 }
+ }
+}
+node {
+ name: "placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype" value { type: DT_FLOAT }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim { size: 2 }
+ }
+ }
+ }
+}
+node {
+ name: "concat_out"
+ op: "ConcatV2"
+ input: "concat"
+ input: "placeholder"
+ input: "axis"
+ attr {
+ key: "N"
+ value { i: 2 }
+ }
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "Tidx"
+ value { type: DT_INT32 }
+ }
+}
--- /dev/null
+input, placeholder:0, TF_FLOAT, [6]
+output, reshape:0, TF_FLOAT, [3, 2]
--- /dev/null
+# Network with dynamic reshape which has resolvable wildcard dimension
+node {
+ name: "placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim { size: 6 }
+ }
+ }
+ }
+}
+node {
+ name: "shape"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_INT32 }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape {
+ dim { size: 2 }
+ }
+ int_val: -1
+ int_val: 2
+ }
+ }
+ }
+}
+node {
+ name: "reshape"
+ op: "Reshape"
+ input: "placeholder"
+ input: "shape"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "Tshape"
+ value { type: DT_INT32 }
+ }
+}
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [6]
+output, Reshape:0, TF_FLOAT, [2, 3]
--- /dev/null
+# Network containing Shape node, which becomes Reshape's 'shape' input
+# Note that this is a work-around to test Shape
+#
+# (tensor)
+# Placeholder ---------- Reshape
+# /
+# Const --- Shape ---
+# (shape)
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim { size: 6 }
+ }
+ }
+ }
+}
+node {
+ name: "Const"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim { size: 2 }
+ dim { size: 3 }
+ }
+ float_val: 1.0
+ }
+ }
+ }
+}
+node {
+ name: "Shape"
+ op: "Shape"
+ input: "Const"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "out_type"
+ value { type: DT_INT32 }
+ }
+}
+node {
+ name: "Reshape"
+ op: "Reshape"
+ input: "Placeholder"
+ input: "Shape"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "Tshape"
+ value { type: DT_INT32 }
+ }
+}
--- /dev/null
+input, placeholder:0, TF_FLOAT, [2, 1, 1, 3]
+output, reshape_2:0, TF_FLOAT, [2, 3]
--- /dev/null
+# Mock of the Epilogue, using ReLU instead of Softmax
+node {
+ name: "placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim { size: 2 }
+ dim { size: 1 }
+ dim { size: 1 }
+ dim { size: 3 }
+ }
+ }
+ }
+}
+node {
+ name: "squeeze"
+ op: "Squeeze"
+ input: "placeholder"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "squeeze_dims"
+ value {
+ list { i: 1 i: 2 }
+ }
+ }
+}
+node {
+ name: "Reshape/shape"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value { type: DT_INT32 }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_INT32
+ tensor_shape {
+ dim { size: 2 }
+ }
+ int_val: -1
+ int_val: 3
+ }
+ }
+ }
+}
+node {
+ name: "reshape_1"
+ op: "Reshape"
+ input: "squeeze"
+ input: "Reshape/shape"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "Tshape"
+ value { type: DT_INT32 }
+ }
+}
+node {
+ name: "relu"
+ op: "Relu"
+ input: "reshape_1"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+}
+node {
+ name: "shape"
+ op: "Shape"
+ input: "squeeze"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "out_type"
+ value { type: DT_INT32 }
+ }
+}
+node {
+ name: "reshape_2"
+ op: "Reshape"
+ input: "relu"
+ input: "shape"
+ attr {
+ key: "T"
+ value { type: DT_FLOAT }
+ }
+ attr {
+ key: "Tshape"
+ value { type: DT_INT32 }
+ }
+}
--- /dev/null
+input, Placeholder:0, TF_FLOAT, [2, 3]
+output, as_rsqrt:0, TF_FLOAT, [2, 3]
--- /dev/null
+# A simple network that simulates Rsqrt: 1.0 / Sqrt(input)
+node {
+ name: "Placeholder"
+ op: "Placeholder"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "shape"
+ value {
+ shape {
+ dim {
+ size: 2
+ }
+ dim {
+ size: 3
+ }
+ }
+ }
+ }
+}
+node {
+ name: "SQRT_02"
+ op: "Sqrt"
+ input: "Placeholder"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}
+node {
+ name: "Const"
+ op: "Const"
+ attr {
+ key: "dtype"
+ value {
+ type: DT_FLOAT
+ }
+ }
+ attr {
+ key: "value"
+ value {
+ tensor {
+ dtype: DT_FLOAT
+ tensor_shape {
+ dim {
+ size: 2
+ }
+ dim {
+ size: 3
+ }
+ }
+ float_val: 1.0
+ }
+ }
+ }
+}
+node {
+ name: "as_rsqrt"
+ op: "RealDiv"
+ input: "Const"
+ input: "SQRT_02"
+ attr {
+ key: "T"
+ value {
+ type: DT_FLOAT
+ }
+ }
+}