summaryrefslogtreecommitdiff
path: root/nn/runtime/test/specs
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2019-11-05 16:05:47 -0800
committerXusong Wang <xusongw@google.com>2020-03-18 16:30:18 -0700
commit8b98abf69eb9dffef705bee72bbc85d66a9b42a1 (patch)
treec8d64c43517164b43235462c8ba9b6581d1bcb24 /nn/runtime/test/specs
parenta52c7f4aadc88ed25547f8869dcde4e934e0d5eb (diff)
downloadml-8b98abf69eb9dffef705bee72bbc85d66a9b42a1.tar.gz
Add tests for corner cases of quant8 l2 norm.
Bug: 143972021 Test: NNT_static Change-Id: I8d1eccd3141e7f57c4b85b5dd06686c69e301aa7
Diffstat (limited to 'nn/runtime/test/specs')
-rw-r--r--nn/runtime/test/specs/V1_2/l2_normalization_axis.mod.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/nn/runtime/test/specs/V1_2/l2_normalization_axis.mod.py b/nn/runtime/test/specs/V1_2/l2_normalization_axis.mod.py
index ba8e24ad6..036e17482 100644
--- a/nn/runtime/test/specs/V1_2/l2_normalization_axis.mod.py
+++ b/nn/runtime/test/specs/V1_2/l2_normalization_axis.mod.py
@@ -14,6 +14,7 @@
# limitations under the License.
#
+# TEST 1: L2_NORMALIZATION with axis parameter
i1 = Input("op1", "TENSOR_FLOAT32", "{2, 2, 2, 3}") # input 0
o1 = Output("op2", "TENSOR_FLOAT32", "{2, 2, 2, 3}") # output 0
axis = Int32Scalar("axis", -1) # last axis
@@ -45,3 +46,15 @@ example0 = {
# All dimensions, with all possible axis parameter
Model().Operation("L2_NORMALIZATION", i1, axis).To(o1)
Example(example0).AddAllDimsAndAxis(i1, o1, axis).AddVariations("relaxed", "float16", quant8)
+
+
+# TEST 2: Corner cases for TENSOR_QUANT8_ASYMM data type.
+i2 = Input("op1", "TENSOR_QUANT8_ASYMM", "{3, 1}, 0.904414f, 246")
+o2 = Output("op2", "TENSOR_QUANT8_ASYMM", "{3, 1}, 0.0078125f, 128")
+axis = Int32Scalar("axis", -1) # last axis
+
+Model("corner_case").Operation("L2_NORMALIZATION", i2, axis).To(o2)
+Example({
+ i2: [245, 247, 246],
+ o2: [0, 255, 128],
+}).AddAllDimsAndAxis(i2, o2, axis)