diff options
author | 남궁석/On-Device Lab(SR)/Engineer/삼성전자 <sk.namkoong@samsung.com> | 2019-07-04 16:45:55 +0900 |
---|---|---|
committer | 박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com> | 2019-07-04 16:45:55 +0900 |
commit | 12cfb6d0cd29edf572edd7bfd9092daf9f04bc32 (patch) | |
tree | 6c1f1d86afe679cc64f00cf5877383fc9ee24f36 | |
parent | 6631d029771db26234bbf046ca3f0decaa14e48e (diff) | |
download | nnfw-12cfb6d0cd29edf572edd7bfd9092daf9f04bc32.tar.gz nnfw-12cfb6d0cd29edf572edd7bfd9092daf9f04bc32.tar.bz2 nnfw-12cfb6d0cd29edf572edd7bfd9092daf9f04bc32.zip |
[TFtest] Add TF_SMALL_NET_0003 test (#4093)
This commit adds TF_SMALL_NET_0003 test which sequentially performs
Conv2d - FusedBatchNorm
Signed-off-by: Seok NamKoong <sk.namkoong@samsung.com>
-rw-r--r-- | res/TensorFlowTests/TF_SMALL_NET_0003/test.info | 2 | ||||
-rw-r--r-- | res/TensorFlowTests/TF_SMALL_NET_0003/test.pbtxt | 244 | ||||
-rw-r--r-- | res/TensorFlowTests/TF_SMALL_NET_0003/test.py | 14 |
3 files changed, 260 insertions, 0 deletions
diff --git a/res/TensorFlowTests/TF_SMALL_NET_0003/test.info b/res/TensorFlowTests/TF_SMALL_NET_0003/test.info new file mode 100644 index 000000000..ee7d13cd1 --- /dev/null +++ b/res/TensorFlowTests/TF_SMALL_NET_0003/test.info @@ -0,0 +1,2 @@ +input, Placeholder:0, TF_FLOAT, [1, 3, 3, 5] +output, FusedBatchNorm:0, TF_FLOAT, [1, 3, 3, 1] diff --git a/res/TensorFlowTests/TF_SMALL_NET_0003/test.pbtxt b/res/TensorFlowTests/TF_SMALL_NET_0003/test.pbtxt new file mode 100644 index 000000000..cf6b1a7db --- /dev/null +++ b/res/TensorFlowTests/TF_SMALL_NET_0003/test.pbtxt @@ -0,0 +1,244 @@ +# 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 + } + } +} diff --git a/res/TensorFlowTests/TF_SMALL_NET_0003/test.py b/res/TensorFlowTests/TF_SMALL_NET_0003/test.py new file mode 100644 index 000000000..8a8e9c8c3 --- /dev/null +++ b/res/TensorFlowTests/TF_SMALL_NET_0003/test.py @@ -0,0 +1,14 @@ +# 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 + +input = tf.placeholder(tf.float32, [1, 3, 3, 5]) +filter = tf.constant(1.0, shape=[2, 2, 5, 1]) +conv = tf.nn.conv2d(input, filter=filter, 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()) |