From c0f74da9faad6671bda8d947f8122bfd5141220f Mon Sep 17 00:00:00 2001 From: Xusong Wang Date: Wed, 18 Mar 2020 16:57:35 -0700 Subject: Document and test L2_NORMALIZATION with input of all zeros. Fixes: 143985908 Test: NNT_static Change-Id: I97e662612947895e0244a8242728d362c0063f89 --- .../test/specs/V1_3/l2_normalization_zeros.mod.py | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 nn/runtime/test/specs/V1_3/l2_normalization_zeros.mod.py (limited to 'nn/runtime/test/specs/V1_3') 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") -- cgit v1.2.3