summaryrefslogtreecommitdiff
path: root/nn/runtime/test/specs
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2020-03-20 00:56:49 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2020-03-20 00:56:49 +0000
commita5ee115de99bc7e11f5f3050d34c7e38b6a52bdd (patch)
treeece8c4bf32eb942553ca2c2e2c457c4027bf345b /nn/runtime/test/specs
parent666dfa174d996d22c973575327d1a91dd9a71733 (diff)
parent1c52c96ae68f514b64ff3e29f09d1b434ae921fd (diff)
downloadml-a5ee115de99bc7e11f5f3050d34c7e38b6a52bdd.tar.gz
Merge changes I32d7b435,I8904d7ca,I681fad8e,Iaf1d9b66,I30e89ce4 into rvc-dev
* changes: Add SQUEEZE with omitted axis in RGG. Fix SQUEEZE with optional squeeze dims. Add TRANSPOSE with omitted permutation to RGG. Support omitted operand in RGG. Enable RGG to generate a roi tensor of lifetime SUBGRAPH_INPUT.
Diffstat (limited to 'nn/runtime/test/specs')
-rw-r--r--nn/runtime/test/specs/V1_1/squeeze_omitted.mod.py31
-rw-r--r--nn/runtime/test/specs/V1_2/squeeze_float16.mod.py21
-rw-r--r--nn/runtime/test/specs/V1_3/squeeze_quant8_signed.mod.py30
3 files changed, 63 insertions, 19 deletions
diff --git a/nn/runtime/test/specs/V1_1/squeeze_omitted.mod.py b/nn/runtime/test/specs/V1_1/squeeze_omitted.mod.py
new file mode 100644
index 000000000..77f02466d
--- /dev/null
+++ b/nn/runtime/test/specs/V1_1/squeeze_omitted.mod.py
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+i1 = Input("input", "TENSOR_FLOAT32", "{4, 1, 1, 2}")
+squeezeDims = Parameter("squeezeDims", ["TENSOR_INT32", [0]], value=None)
+o1 = Output("output", "TENSOR_FLOAT32", "{4, 2}")
+Model().Operation("SQUEEZE", i1, squeezeDims).To(o1)
+
+quant8 = DataTypeConverter().Identify({
+ i1: ("TENSOR_QUANT8_ASYMM", 0.5, 0),
+ o1: ("TENSOR_QUANT8_ASYMM", 0.5, 0)
+})
+
+# Instantiate an example
+Example({
+ i1: [1.4, 2.3, 3.2, 4.1, 5.4, 6.3, 7.2, 8.1],
+ o1: [1.4, 2.3, 3.2, 4.1, 5.4, 6.3, 7.2, 8.1]
+}).AddVariations("relaxed", quant8)
diff --git a/nn/runtime/test/specs/V1_2/squeeze_float16.mod.py b/nn/runtime/test/specs/V1_2/squeeze_float16.mod.py
index e5f18a524..f2ad4b3d1 100644
--- a/nn/runtime/test/specs/V1_2/squeeze_float16.mod.py
+++ b/nn/runtime/test/specs/V1_2/squeeze_float16.mod.py
@@ -1,3 +1,19 @@
+#
+# Copyright (C) 2020 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
model = Model()
i1 = Input("input", "TENSOR_FLOAT16", "{4, 1, 1, 2}")
squeezeDims = Parameter("squeezeDims", "TENSOR_INT32", "{2}", [1, 2])
@@ -14,3 +30,8 @@ output0 = {output: # output 0
# Instantiate an example
Example((input0, output0))
+
+# Test with omitted squeeze dims
+squeezeDims = Parameter("squeezeDims", ["TENSOR_INT32", [0]], value=None)
+Model("omitted").Operation("SQUEEZE", i1, squeezeDims).To(output)
+Example((input0, output0))
diff --git a/nn/runtime/test/specs/V1_3/squeeze_quant8_signed.mod.py b/nn/runtime/test/specs/V1_3/squeeze_quant8_signed.mod.py
index e4fcb72e8..fac9bea89 100644
--- a/nn/runtime/test/specs/V1_3/squeeze_quant8_signed.mod.py
+++ b/nn/runtime/test/specs/V1_3/squeeze_quant8_signed.mod.py
@@ -21,24 +21,16 @@ output = Output("output", "TENSOR_QUANT8_ASYMM_SIGNED", "{1, 24}, 1.0, -128")
model = model.Operation("SQUEEZE", i1, squeezeDims).To(output)
-# Example 1. Input in operand 0,
-input0 = {
- i1: # input 0
- [
- -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117,
- -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, -106,
- -105, -104
- ]
-}
-
-output0 = {
- output: # output 0
- [
- -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117,
- -116, -115, -114, -113, -112, -111, -110, -109, -108, -107, -106,
- -105, -104
- ]
-}
+data = [
+ -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116, -115, -114, -113, -112,
+ -111, -110, -109, -108, -107, -106, -105, -104
+]
# Instantiate an example
-Example((input0, output0))
+Example({i1: data, output: data})
+
+# Test with omitted squeeze dims
+squeezeDims = Parameter("squeezeDims", ["TENSOR_INT32", [0]], value=None)
+output = Output("output", "TENSOR_QUANT8_ASYMM_SIGNED", "{24}, 1.0, -128")
+Model("omitted").Operation("SQUEEZE", i1, squeezeDims).To(output)
+Example({i1: data, output: data})