From e9b39958214c02092e0f3c145f7d06de3188278b Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EB=B0=95=EC=A2=85=ED=98=84/On-Device=20Lab=28SR=29/Staff?= =?utf8?q?=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 4 Jul 2019 16:29:25 +0900 Subject: [PATCH] [tf2tflite] Use shared testcases (#4090) This commit rewrites tf2tflite test framework to use shared testcases and removes tf2tflite-local testcases. tf2tflite test framework now manages whitelist internally. Signed-off-by: Jonghyun Park --- contrib/tf2tflite/.gitignore | 1 + contrib/tf2tflite/CMakeLists.txt | 24 +++- contrib/tf2tflite/test.lst | 8 ++ contrib/tf2tflite/tests/BiasAdd_002/test.info | 2 - contrib/tf2tflite/tests/BiasAdd_002/test.pbtxt | 51 ------- contrib/tf2tflite/tests/MaxPool_001/test.info | 2 - contrib/tf2tflite/tests/MaxPool_001/test.pbtxt | 48 ------- .../tests/TF_IV3_AvgPool_GlobalPooling/test.info | 2 - .../tests/TF_IV3_AvgPool_GlobalPooling/test.pbtxt | 61 -------- .../tests/TF_IV3_AvgPool_Module/test.info | 2 - .../tests/TF_IV3_AvgPool_Module/test.pbtxt | 63 -------- .../tf2tflite/tests/TF_IV3_Conv2D_000/test.info | 2 - .../tf2tflite/tests/TF_IV3_Conv2D_000/test.pbtxt | 89 ------------ contrib/tf2tflite/tests/TF_IV3_MaxPool/test.info | 2 - contrib/tf2tflite/tests/TF_IV3_MaxPool/test.pbtxt | 65 --------- .../tf2tflite/tests/TF_SMALL_NET_0000/test.info | 3 - .../tf2tflite/tests/TF_SMALL_NET_0000/test.pbtxt | 102 ------------- .../tf2tflite/tests/TF_SMALL_NET_0001/test.info | 2 - .../tf2tflite/tests/TF_SMALL_NET_0001/test.pbtxt | 160 --------------------- 19 files changed, 31 insertions(+), 658 deletions(-) create mode 100644 contrib/tf2tflite/.gitignore create mode 100644 contrib/tf2tflite/test.lst delete mode 100644 contrib/tf2tflite/tests/BiasAdd_002/test.info delete mode 100644 contrib/tf2tflite/tests/BiasAdd_002/test.pbtxt delete mode 100644 contrib/tf2tflite/tests/MaxPool_001/test.info delete mode 100644 contrib/tf2tflite/tests/MaxPool_001/test.pbtxt delete mode 100644 contrib/tf2tflite/tests/TF_IV3_AvgPool_GlobalPooling/test.info delete mode 100644 contrib/tf2tflite/tests/TF_IV3_AvgPool_GlobalPooling/test.pbtxt delete mode 100644 contrib/tf2tflite/tests/TF_IV3_AvgPool_Module/test.info delete mode 100644 contrib/tf2tflite/tests/TF_IV3_AvgPool_Module/test.pbtxt delete mode 100644 contrib/tf2tflite/tests/TF_IV3_Conv2D_000/test.info delete mode 100644 contrib/tf2tflite/tests/TF_IV3_Conv2D_000/test.pbtxt delete mode 100644 contrib/tf2tflite/tests/TF_IV3_MaxPool/test.info delete mode 100644 contrib/tf2tflite/tests/TF_IV3_MaxPool/test.pbtxt delete mode 100644 contrib/tf2tflite/tests/TF_SMALL_NET_0000/test.info delete mode 100644 contrib/tf2tflite/tests/TF_SMALL_NET_0000/test.pbtxt delete mode 100644 contrib/tf2tflite/tests/TF_SMALL_NET_0001/test.info delete mode 100644 contrib/tf2tflite/tests/TF_SMALL_NET_0001/test.pbtxt diff --git a/contrib/tf2tflite/.gitignore b/contrib/tf2tflite/.gitignore new file mode 100644 index 0000000..8dbfa90 --- /dev/null +++ b/contrib/tf2tflite/.gitignore @@ -0,0 +1 @@ +/test.local.lst diff --git a/contrib/tf2tflite/CMakeLists.txt b/contrib/tf2tflite/CMakeLists.txt index a81e7e7..68a0b7b 100644 --- a/contrib/tf2tflite/CMakeLists.txt +++ b/contrib/tf2tflite/CMakeLists.txt @@ -23,6 +23,9 @@ target_link_libraries(tf2tflite PRIVATE locop) target_link_libraries(tf2tflite PRIVATE hermes_std) target_link_libraries(tf2tflite PRIVATE stdex) +nncc_include(ListFile) +nncc_find_resource(TensorFlowTests) + unset(REQUIRED_TARGETS) list(APPEND REQUIRED_TARGETS tfkit) list(APPEND REQUIRED_TARGETS nnkit-run) @@ -41,16 +44,33 @@ message(STATUS "tf2tflite: run tests") # Copy [PREFIX]/test.info to PREFIX.info in binary folder # Encode PREFIX.pbtxt to PREFIX.pb # -set(TEST_REPO "${CMAKE_CURRENT_SOURCE_DIR}/tests") +set(TEST_REPO "${TensorFlowTests_DIR}") set(TEST_PBTXT_FILENAME "test.pbtxt") set(TEST_INFO_FILENAME "test.info") -file(GLOB TESTCASES RELATIVE ${TEST_REPO} "${TEST_REPO}/*") +unset(TESTCASES) + +# Read "test.lst" +ListFile_Read("test.lst" COMMITED_TESTS) +list(APPEND TESTCASES ${COMMITED_TESTS}) + +# Read "test.local.lst" if it exists +# +# NOTE CMake recommends "full path" for EXISTS +# https://cmake.org/cmake/help/v3.1/command/if.html +if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/test.local.lst") + ListFile_Read("test.local.lst" LOCAL_TESTS) + list(APPEND TESTCASES ${LOCAL_TESTS}) +endif() unset(TEST_DEPS) unset(TEST_NAMES) foreach(PREFIX IN ITEMS ${TESTCASES}) + if(NOT IS_DIRECTORY "${TEST_REPO}/${PREFIX}") + message(FATAL_ERROR "Missing '${PREFIX}' test") + endif() + set(PBTXT_SOURCE_PATH "${TEST_REPO}/${PREFIX}/${TEST_PBTXT_FILENAME}") set(INFO_SOURCE_PATH "${TEST_REPO}/${PREFIX}/${TEST_INFO_FILENAME}") diff --git a/contrib/tf2tflite/test.lst b/contrib/tf2tflite/test.lst new file mode 100644 index 0000000..492b66b --- /dev/null +++ b/contrib/tf2tflite/test.lst @@ -0,0 +1,8 @@ +BiasAdd_002 +MaxPool_001 +TF_IV3_AvgPool_GlobalPooling +TF_IV3_AvgPool_Module +TF_IV3_Conv2D_000 +TF_IV3_MaxPool +TF_SMALL_NET_0000 +TF_SMALL_NET_0001 diff --git a/contrib/tf2tflite/tests/BiasAdd_002/test.info b/contrib/tf2tflite/tests/BiasAdd_002/test.info deleted file mode 100644 index 2133df4..0000000 --- a/contrib/tf2tflite/tests/BiasAdd_002/test.info +++ /dev/null @@ -1,2 +0,0 @@ -input, input:0, TF_FLOAT, [1, 16, 16, 2] -output, output:0, TF_FLOAT, [1, 16, 16, 2] diff --git a/contrib/tf2tflite/tests/BiasAdd_002/test.pbtxt b/contrib/tf2tflite/tests/BiasAdd_002/test.pbtxt deleted file mode 100644 index 336a103..0000000 --- a/contrib/tf2tflite/tests/BiasAdd_002/test.pbtxt +++ /dev/null @@ -1,51 +0,0 @@ -node { - name: "input" - op: "Placeholder" - attr { - key: "dtype" - value { type: DT_FLOAT } - } - attr { - key: "shape" - value { - shape { - dim { size: 1 } - dim { size: 16 } - dim { size: 16 } - dim { size: 2 } - } - } - } -} -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.0 - } - } - } -} -node { - name: "output" - op: "BiasAdd" - input: "input" - input: "bias" - attr { - key: "T" - value { type: DT_FLOAT } - } - attr { - key: "data_format" - value { s: "NHWC" } - } -} diff --git a/contrib/tf2tflite/tests/MaxPool_001/test.info b/contrib/tf2tflite/tests/MaxPool_001/test.info deleted file mode 100644 index 513a83c..0000000 --- a/contrib/tf2tflite/tests/MaxPool_001/test.info +++ /dev/null @@ -1,2 +0,0 @@ -input, placeholder:0, TF_FLOAT, [1, 4, 4, 1] -output, maxpool2d:0, TF_FLOAT, [1, 3, 3, 1] diff --git a/contrib/tf2tflite/tests/MaxPool_001/test.pbtxt b/contrib/tf2tflite/tests/MaxPool_001/test.pbtxt deleted file mode 100644 index dfa58d4..0000000 --- a/contrib/tf2tflite/tests/MaxPool_001/test.pbtxt +++ /dev/null @@ -1,48 +0,0 @@ -node { - name: "placeholder" - op: "Placeholder" - attr { - key: "dtype" - value { type: DT_FLOAT } - } - attr { - key: "shape" - value { - shape { - dim { size: 1 } - dim { size: 4 } - dim { size: 4 } - dim { size: 1 } - } - } - } -} -node { - name: "maxpool2d" - 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: 2 i: 2 i: 1 } - } - } - attr { - key: "padding" - value { s: "VALID" } - } - attr { - key: "strides" - value { - list { i: 1 i: 1 i: 1 i: 1 } - } - } -} diff --git a/contrib/tf2tflite/tests/TF_IV3_AvgPool_GlobalPooling/test.info b/contrib/tf2tflite/tests/TF_IV3_AvgPool_GlobalPooling/test.info deleted file mode 100644 index e9413cb..0000000 --- a/contrib/tf2tflite/tests/TF_IV3_AvgPool_GlobalPooling/test.info +++ /dev/null @@ -1,2 +0,0 @@ -input, placeholder:0, TF_FLOAT, [1, 8, 8, 1] -output, avgpool2d:0, TF_FLOAT, [1, 1, 1, 1] diff --git a/contrib/tf2tflite/tests/TF_IV3_AvgPool_GlobalPooling/test.pbtxt b/contrib/tf2tflite/tests/TF_IV3_AvgPool_GlobalPooling/test.pbtxt deleted file mode 100644 index e8cc76b..0000000 --- a/contrib/tf2tflite/tests/TF_IV3_AvgPool_GlobalPooling/test.pbtxt +++ /dev/null @@ -1,61 +0,0 @@ -# HOW TO GENERATE: -# -# import tensorflow as tf -# value = tf.placeholder(dtype=tf.float32, shape=[1, 8, 8, 1], name='placeholder') -# output = tf.nn.avg_pool(value, [1, 8, 8, 1], [1, 1, 1, 1], 'VALID', name='avgpool2d') -# tf.get_default_graph().as_graph_def() -# -# NOTE 1. The output shape is 1x1x1x1 -# -# >>> tf.graph_util.tensor_shape_from_node_def_name(tf.get_default_graph(), 'avgpool2d') -# TensorShape([Dimension(1), Dimension(1), Dimension(1), Dimension(1)]) -# -# NOTE 2. This test corresponds to the last AvgPool node inception v3 2018.04.27. -node { - name: "placeholder" - op: "Placeholder" - attr { - key: "dtype" - value { type: DT_FLOAT } - } - attr { - key: "shape" - value { - shape { - dim { size: 1 } - dim { size: 8 } - dim { size: 8 } - dim { size: 1 } - } - } - } -} -node { - name: "avgpool2d" - op: "AvgPool" - input: "placeholder" - attr { - key: "T" - value { type: DT_FLOAT } - } - attr { - key: "data_format" - value { s: "NHWC" } - } - attr { - key: "ksize" - value { - list { i: 1 i: 8 i: 8 i: 1 } - } - } - attr { - key: "padding" - value { s: "VALID" } - } - attr { - key: "strides" - value { - list { i: 1 i: 1 i: 1 i: 1 } - } - } -} diff --git a/contrib/tf2tflite/tests/TF_IV3_AvgPool_Module/test.info b/contrib/tf2tflite/tests/TF_IV3_AvgPool_Module/test.info deleted file mode 100644 index 87f6fa7..0000000 --- a/contrib/tf2tflite/tests/TF_IV3_AvgPool_Module/test.info +++ /dev/null @@ -1,2 +0,0 @@ -input, placeholder:0, TF_FLOAT, [1, 4, 4, 1] -output, avgpool2d:0, TF_FLOAT, [1, 4, 4, 1] diff --git a/contrib/tf2tflite/tests/TF_IV3_AvgPool_Module/test.pbtxt b/contrib/tf2tflite/tests/TF_IV3_AvgPool_Module/test.pbtxt deleted file mode 100644 index 3b8a15e..0000000 --- a/contrib/tf2tflite/tests/TF_IV3_AvgPool_Module/test.pbtxt +++ /dev/null @@ -1,63 +0,0 @@ -# HOW TO GENERATE: -# -# import tensorflow as tf -# value = tf.placeholder(dtype=tf.float32, shape=[1, 4, 4, 1], name='placeholder') -# output = tf.nn.avg_pool(value, [1, 3, 3, 1], [1, 1, 1, 1], 'SAME', name='avgpool2d') -# tf.get_default_graph().as_graph_def() -# -# NOTE 1. The output shape is 1x4x4x1 -# -# >>> tf.graph_util.tensor_shape_from_node_def_name(tf.get_default_graph(), 'avgpool2d') -# TensorShape([Dimension(1), Dimension(4), Dimension(4), Dimension(1)]) -# -# NOTE 2. Almost all the AvgPool nodes in inception v3 2018.04.27 use this configuration. -# -# The only exception is "InceptionV3/Logits/AvgPool_1a_8x8/AvgPool" which performs global average pooling. -node { - name: "placeholder" - op: "Placeholder" - attr { - key: "dtype" - value { type: DT_FLOAT } - } - attr { - key: "shape" - value { - shape { - dim { size: 1 } - dim { size: 4 } - dim { size: 4 } - dim { size: 1 } - } - } - } -} -node { - name: "avgpool2d" - op: "AvgPool" - input: "placeholder" - attr { - key: "T" - value { type: DT_FLOAT } - } - attr { - key: "data_format" - value { s: "NHWC" } - } - attr { - key: "ksize" - value { - list { i: 1 i: 3 i: 3 i: 1 } - } - } - attr { - key: "padding" - value { s: "SAME" } - } - attr { - key: "strides" - value { - list { i: 1 i: 1 i: 1 i: 1 } - } - } -} diff --git a/contrib/tf2tflite/tests/TF_IV3_Conv2D_000/test.info b/contrib/tf2tflite/tests/TF_IV3_Conv2D_000/test.info deleted file mode 100644 index 9088834..0000000 --- a/contrib/tf2tflite/tests/TF_IV3_Conv2D_000/test.info +++ /dev/null @@ -1,2 +0,0 @@ -input, ifm:0, TF_FLOAT, [1, 7, 7, 4] -output, ofm:0, TF_FLOAT, [1, 3, 3, 6] diff --git a/contrib/tf2tflite/tests/TF_IV3_Conv2D_000/test.pbtxt b/contrib/tf2tflite/tests/TF_IV3_Conv2D_000/test.pbtxt deleted file mode 100644 index 076f4f6..0000000 --- a/contrib/tf2tflite/tests/TF_IV3_Conv2D_000/test.pbtxt +++ /dev/null @@ -1,89 +0,0 @@ -# HOW TO GENERATE: -# -# import tensorflow as tf -# I = 4 -# O = 6 -# ifm = tf.placeholder(dtype=tf.float32, shape=[1, 7, 7, I], name='ifm') -# ker = tf.constant(dtype=tf.float32, shape=[3, 3, I, O], name='ker', value=1.1) -# ofm = tf.nn.conv2d(input=ifm, filter=ker, strides=[1, 2, 2, 1], padding='VALID', name='ofm') -# tf.get_default_graph().as_graph_def() -# -# NOTE 1. The output shape is 1x3x3x6 -# -# >>> tf.graph_util.tensor_shape_from_node_def_name(tf.get_default_graph(), 'ofm') -# TensorShape([Dimension(1), Dimension(3), Dimension(3), Dimension(6)]) -# -# NOTE 2. This test corresponds to "InceptionV3/InceptionV3/Conv2d_1a_3x3/Conv2D" node -# -node { - name: "ifm" - op: "Placeholder" - attr { - key: "dtype" - value { type: DT_FLOAT } - } - attr { - key: "shape" - value { - shape { - dim { size: 1 } - dim { size: 7 } - dim { size: 7 } - dim { size: 4 } - } - } - } -} -node { - name: "ker" - op: "Const" - attr { - key: "dtype" - value { type: DT_FLOAT } - } - attr { - key: "value" - value { - tensor { - dtype: DT_FLOAT - tensor_shape { - dim { size: 3 } - dim { size: 3 } - dim { size: 4 } - dim { size: 6 } - } - 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: 2 i: 2 i: 1 } - } - } -} diff --git a/contrib/tf2tflite/tests/TF_IV3_MaxPool/test.info b/contrib/tf2tflite/tests/TF_IV3_MaxPool/test.info deleted file mode 100644 index 059b21c..0000000 --- a/contrib/tf2tflite/tests/TF_IV3_MaxPool/test.info +++ /dev/null @@ -1,2 +0,0 @@ -input, placeholder:0, TF_FLOAT, [1, 7, 7, 1] -output, maxpool2d:0, TF_FLOAT, [1, 3, 3, 1] diff --git a/contrib/tf2tflite/tests/TF_IV3_MaxPool/test.pbtxt b/contrib/tf2tflite/tests/TF_IV3_MaxPool/test.pbtxt deleted file mode 100644 index b1eadcc..0000000 --- a/contrib/tf2tflite/tests/TF_IV3_MaxPool/test.pbtxt +++ /dev/null @@ -1,65 +0,0 @@ -# HOW TO GENERATE: -# -# import tensorflow as tf -# value = tf.placeholder(dtype=tf.float32, shape=[1, 7, 7, 1], name='placeholder') -# output = tf.nn.max_pool(value, [1, 3, 3, 1], [1, 2, 2, 1], 'VALID', name='maxpool2d') -# tf.get_default_graph().as_graph_def() -# -# NOTE 1. The output shape is 1x3x3x1 -# -# >>> tf.graph_util.tensor_shape_from_node_def_name(tf.get_default_graph(), 'maxpool2d') -# TensorShape([Dimension(1), Dimension(3), Dimension(3), Dimension(1)]) -# -# NOTE 2. All the MaxPool nodes in inception v3 2018.04.27 use this configuration. -# - InceptionV3/InceptionV3/MaxPool_3a_3x3/MaxPool -# - InceptionV3/InceptionV3/MaxPool_5a_3x3/MaxPool -# - InceptionV3/InceptionV3/Mixed_6a/Branch_2/MaxPool_1a_3x3/MaxPool -# - InceptionV3/InceptionV3/Mixed_7a/Branch_2/MaxPool_1a_3x3/MaxPool -node { - name: "placeholder" - op: "Placeholder" - attr { - key: "dtype" - value { type: DT_FLOAT } - } - attr { - key: "shape" - value { - shape { - dim { size: 1 } - dim { size: 7 } - dim { size: 7 } - dim { size: 1 } - } - } - } -} -node { - name: "maxpool2d" - 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: 3 i: 3 i: 1 } - } - } - attr { - key: "padding" - value { s: "VALID" } - } - attr { - key: "strides" - value { - list { i: 1 i: 2 i: 2 i: 1 } - } - } -} diff --git a/contrib/tf2tflite/tests/TF_SMALL_NET_0000/test.info b/contrib/tf2tflite/tests/TF_SMALL_NET_0000/test.info deleted file mode 100644 index bdde912..0000000 --- a/contrib/tf2tflite/tests/TF_SMALL_NET_0000/test.info +++ /dev/null @@ -1,3 +0,0 @@ -# conv2d with VALID, stride = 1, 1 -input, ifm:0, TF_FLOAT, [1, 5, 5, 3] -output, maxpool:0, TF_FLOAT, [1, 4, 4, 2] diff --git a/contrib/tf2tflite/tests/TF_SMALL_NET_0000/test.pbtxt b/contrib/tf2tflite/tests/TF_SMALL_NET_0000/test.pbtxt deleted file mode 100644 index 5aafa31..0000000 --- a/contrib/tf2tflite/tests/TF_SMALL_NET_0000/test.pbtxt +++ /dev/null @@ -1,102 +0,0 @@ -# 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 } - } - } -} diff --git a/contrib/tf2tflite/tests/TF_SMALL_NET_0001/test.info b/contrib/tf2tflite/tests/TF_SMALL_NET_0001/test.info deleted file mode 100644 index 0e8caae..0000000 --- a/contrib/tf2tflite/tests/TF_SMALL_NET_0001/test.info +++ /dev/null @@ -1,2 +0,0 @@ -input, in:0, TF_FLOAT, [1, 5, 5, 3] -output, out:0, TF_FLOAT, [1, 4, 4, 5] diff --git a/contrib/tf2tflite/tests/TF_SMALL_NET_0001/test.pbtxt b/contrib/tf2tflite/tests/TF_SMALL_NET_0001/test.pbtxt deleted file mode 100644 index fc84d61..0000000 --- a/contrib/tf2tflite/tests/TF_SMALL_NET_0001/test.pbtxt +++ /dev/null @@ -1,160 +0,0 @@ -# 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 } - } - } -} -- 2.7.4