summaryrefslogtreecommitdiff
path: root/nn/runtime/test/specs/V1_3
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2020-03-18 16:57:35 -0700
committerXusong Wang <xusongw@google.com>2020-03-18 17:20:14 -0700
commitc0f74da9faad6671bda8d947f8122bfd5141220f (patch)
treee40e2f433bbf03761173b887926705cd049538fd /nn/runtime/test/specs/V1_3
parent8b98abf69eb9dffef705bee72bbc85d66a9b42a1 (diff)
downloadml-c0f74da9faad6671bda8d947f8122bfd5141220f.tar.gz
Document and test L2_NORMALIZATION with input of all zeros.
Fixes: 143985908 Test: NNT_static Change-Id: I97e662612947895e0244a8242728d362c0063f89
Diffstat (limited to 'nn/runtime/test/specs/V1_3')
-rw-r--r--nn/runtime/test/specs/V1_3/l2_normalization_zeros.mod.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/nn/runtime/test/specs/V1_3/l2_normalization_zeros.mod.py b/nn/runtime/test/specs/V1_3/l2_normalization_zeros.mod.py
new file mode 100644
index 000000000..6af710795
--- /dev/null
+++ b/nn/runtime/test/specs/V1_3/l2_normalization_zeros.mod.py
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+# Test L2_NORMALIZATION with inputs of all zeros.
+i1 = Input("op1", "TENSOR_FLOAT32", "{2}") # input 0
+o1 = Output("op2", "TENSOR_FLOAT32", "{2}") # output 0
+axis = Int32Scalar("axis", -1) # last axis
+
+quant8 = DataTypeConverter().Identify({
+ i1: ("TENSOR_QUANT8_ASYMM", 0.1, 32),
+ o1: ("TENSOR_QUANT8_ASYMM", 1.0 / 128, 128)
+})
+
+quant8_signed = DataTypeConverter().Identify({
+ i1: ("TENSOR_QUANT8_ASYMM_SIGNED", 0.1, -96),
+ o1: ("TENSOR_QUANT8_ASYMM_SIGNED", 1.0 / 128, 0)
+})
+
+Model().IntroducedIn("V1_2").Operation("L2_NORMALIZATION", i1, axis).To(o1)
+Example({
+ i1: [0, 0],
+ o1: [0, 0]
+}).AddVariations("relaxed", "float16", quant8, quant8_signed)
+
+# TENSOR_QUANT8_ASYMM_SIGNED is a new data type in V1_3.
+Example.SetVersion("V1_3",
+ "l2_normalization_zeros_quant8_signed",
+ "l2_normalization_zeros_quant8_signed_all_inputs_as_internal")