[TFtest] Add TF_SMALL_NET_0004 test (#4095)
author남궁석/On-Device Lab(SR)/Engineer/삼성전자 <sk.namkoong@samsung.com>
Thu, 4 Jul 2019 22:05:27 +0000 (07:05 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 4 Jul 2019 22:05:27 +0000 (07:05 +0900)
* [TFtest] Add TF_SMALL_NET_0004 test

This commit adds TF_SMALL_NET_0004 test which sequentially performs
DepthwiseConv2d - FusedBatchNorm

Signed-off-by: Seok NamKoong <sk.namkoong@samsung.com>
* unpack values

res/TensorFlowTests/TF_SMALL_NET_0004/test.info [new file with mode: 0644]
res/TensorFlowTests/TF_SMALL_NET_0004/test.pbtxt [new file with mode: 0644]
res/TensorFlowTests/TF_SMALL_NET_0004/test.py [new file with mode: 0644]

diff --git a/res/TensorFlowTests/TF_SMALL_NET_0004/test.info b/res/TensorFlowTests/TF_SMALL_NET_0004/test.info
new file mode 100644 (file)
index 0000000..75a8922
--- /dev/null
@@ -0,0 +1,2 @@
+input, Placeholder:0, TF_FLOAT, [1, 3, 3, 5]
+output, FusedBatchNorm:0, TF_FLOAT, [1, 3, 3, 10]
diff --git a/res/TensorFlowTests/TF_SMALL_NET_0004/test.pbtxt b/res/TensorFlowTests/TF_SMALL_NET_0004/test.pbtxt
new file mode 100644 (file)
index 0000000..18cdd65
--- /dev/null
@@ -0,0 +1,218 @@
+# 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
+    }
+  }
+}
diff --git a/res/TensorFlowTests/TF_SMALL_NET_0004/test.py b/res/TensorFlowTests/TF_SMALL_NET_0004/test.py
new file mode 100644 (file)
index 0000000..00ffb2b
--- /dev/null
@@ -0,0 +1,15 @@
+# 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
+
+input = tf.placeholder(tf.float32, [1, 3, 3, 5])
+filter = tf.constant(1.0, shape=[2, 2, 5, 2])
+dconv = tf.nn.depthwise_conv2d(input, filter, [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())