diff options
Diffstat (limited to 'nn/runtime/test/specs/V1_3')
-rw-r--r-- | nn/runtime/test/specs/V1_3/l2_normalization_zeros.mod.py | 41 | ||||
-rw-r--r-- | nn/runtime/test/specs/V1_3/squeeze_quant8_signed.mod.py | 30 |
2 files changed, 52 insertions, 19 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") 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}) |