summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXusong Wang <xusongw@google.com>2019-10-11 15:20:01 -0700
committerXusong Wang <xusongw@google.com>2019-10-24 10:50:15 -0700
commitbf9a242af54231fcab3d235a0217c50bc4be3b07 (patch)
tree2f0032da863fb6998253e1421322056be67b9a85
parent06f3b68d9a5f32aa8d33d12e431163a4410ca4a2 (diff)
downloadml-android10-qpr3-s1-release.tar.gz
Before this change, the variance is miscalculated. The new golden test results are checked against TF 1.14. Bug: 142558844 Test: NNT_static Change-Id: I1a05dca14aed9187255e8fa21645a29f4de5dd28 Merged-In: I1a05dca14aed9187255e8fa21645a29f4de5dd28 (cherry picked from commit 6d0e4547d4066e12eef90a8e5d3e0d15bb21e643)
-rw-r--r--nn/common/operations/InstanceNormalization.cpp14
-rw-r--r--nn/runtime/test/generated/examples/instance_normalization.example.cpp48
-rw-r--r--nn/runtime/test/specs/V1_2/instance_normalization.mod.py16
3 files changed, 42 insertions, 36 deletions
diff --git a/nn/common/operations/InstanceNormalization.cpp b/nn/common/operations/InstanceNormalization.cpp
index c61da0965..84728c45b 100644
--- a/nn/common/operations/InstanceNormalization.cpp
+++ b/nn/common/operations/InstanceNormalization.cpp
@@ -53,20 +53,26 @@ inline bool instanceNormNhwc(const T* inputData, const Shape& inputShape, T gamm
for (uint32_t b = 0; b < numBatches; b++) {
for (uint32_t d = 0; d < depth; d++) {
uint32_t indexBase = b * height * width * depth + d;
- T mean = 0, var = 0;
+ T mean = 0, sigma = 0;
for (uint32_t h = 0; h < height; h++) {
for (uint32_t w = 0; w < width; w++) {
T val = inputData[indexBase + (h * width + w) * depth];
mean += val;
- var += val * val;
+ sigma += val * val;
}
}
+ // Compute the mean and the standard deviation (sigma) of a single layer:
+ // mean = sum(x) / len
+ // sigma = sqrt( sum((x - mean)^2) / len + epsilon )
+ // = sqrt( sum(x^2) / len - mean^2 + epsilon )
mean /= static_cast<T>(height * width);
- var = std::sqrt(static_cast<float>(var / static_cast<T>(height * width)) + epsilon);
+ sigma = std::sqrt(
+ static_cast<float>(sigma / static_cast<T>(height * width) - mean * mean) +
+ epsilon);
for (uint32_t h = 0; h < height; h++) {
for (uint32_t w = 0; w < width; w++) {
uint32_t ind = indexBase + (h * width + w) * depth;
- outputData[ind] = (inputData[ind] - mean) * gamma / var + beta;
+ outputData[ind] = (inputData[ind] - mean) * gamma / sigma + beta;
}
}
}
diff --git a/nn/runtime/test/generated/examples/instance_normalization.example.cpp b/nn/runtime/test/generated/examples/instance_normalization.example.cpp
index 0f1e69aab..9e8c4e2b5 100644
--- a/nn/runtime/test/generated/examples/instance_normalization.example.cpp
+++ b/nn/runtime/test/generated/examples/instance_normalization.example.cpp
@@ -33,7 +33,7 @@ static std::vector<MixedTypedExample> examples_nhwc = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {0.0f, -0.499996f, 0.0f, -0.0999992f, 0.0f, -0.0999992f, 0.0f, 0.6999944f, 0.99995f, -0.6999944f, -0.99995f, 0.499996f, -0.99995f, -1.0999912f, 0.99995f, 1.2999896f}}},
+ .float32Operands = {{0, {0.0f, -1.1470304f, 0.0f, -0.22940612f, 0.0f, -0.22940612f, 0.0f, 1.6058424f, 0.99995005f, -0.7337929f, -0.99995005f, 0.52413774f, -0.99995005f, -1.1531031f, 0.99995005f, 1.3627582f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -90,7 +90,7 @@ static std::vector<MixedTypedExample> examples_nhwc_relaxed = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {0.0f, -0.499996f, 0.0f, -0.0999992f, 0.0f, -0.0999992f, 0.0f, 0.6999944f, 0.99995f, -0.6999944f, -0.99995f, 0.499996f, -0.99995f, -1.0999912f, 0.99995f, 1.2999896f}}},
+ .float32Operands = {{0, {0.0f, -1.1470304f, 0.0f, -0.22940612f, 0.0f, -0.22940612f, 0.0f, 1.6058424f, 0.99995005f, -0.7337929f, -0.99995005f, 0.52413774f, -0.99995005f, -1.1531031f, 0.99995005f, 1.3627582f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -155,7 +155,7 @@ static std::vector<MixedTypedExample> examples_nhwc_float16 = {
// int -> QUANT16_SYMM map
.quant16SymmOperands = {},
// int -> FLOAT16 map
- .float16Operands = {{0, {0.0f, -0.49999600648880005f, 0.0f, -0.09999919682741165f, 0.0f, -0.09999919682741165f, 0.0f, 0.6999943852424622f, 0.9999499917030334f, -0.6999943852424622f, -0.9999499917030334f, 0.49999600648880005f, -0.9999499917030334f, -1.0999912023544312f, 0.9999499917030334f, 1.2999895811080933f}}},
+ .float16Operands = {{0, {0.0f, -1.1470303535461426f, 0.0f, -0.22940611839294434f, 0.0f, -0.22940611839294434f, 0.0f, 1.6058423519134521f, 0.9999500513076782f, -0.7337929010391235f, -0.9999500513076782f, 0.5241377353668213f, -0.9999500513076782f, -1.1531031131744385f, 0.9999500513076782f, 1.3627581596374512f}}},
// int -> BOOL8 map
.bool8Operands = {},
// int -> QUANT8_SYMM_PER_CHANNEL map
@@ -204,7 +204,7 @@ static std::vector<MixedTypedExample> examples_nchw = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -0.499996f, -0.0999992f, -0.0999992f, 0.6999944f, 0.99995f, -0.99995f, -0.99995f, 0.99995f, -0.6999944f, 0.499996f, -1.0999912f, 1.2999896f}}},
+ .float32Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -1.1470304f, -0.22940612f, -0.22940612f, 1.6058424f, 0.99995005f, -0.99995005f, -0.99995005f, 0.99995005f, -0.7337929f, 0.52413774f, -1.1531031f, 1.3627582f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -261,7 +261,7 @@ static std::vector<MixedTypedExample> examples_nchw_relaxed = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -0.499996f, -0.0999992f, -0.0999992f, 0.6999944f, 0.99995f, -0.99995f, -0.99995f, 0.99995f, -0.6999944f, 0.499996f, -1.0999912f, 1.2999896f}}},
+ .float32Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -1.1470304f, -0.22940612f, -0.22940612f, 1.6058424f, 0.99995005f, -0.99995005f, -0.99995005f, 0.99995005f, -0.7337929f, 0.52413774f, -1.1531031f, 1.3627582f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -326,7 +326,7 @@ static std::vector<MixedTypedExample> examples_nchw_float16 = {
// int -> QUANT16_SYMM map
.quant16SymmOperands = {},
// int -> FLOAT16 map
- .float16Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -0.49999600648880005f, -0.09999919682741165f, -0.09999919682741165f, 0.6999943852424622f, 0.9999499917030334f, -0.9999499917030334f, -0.9999499917030334f, 0.9999499917030334f, -0.6999943852424622f, 0.49999600648880005f, -1.0999912023544312f, 1.2999895811080933f}}},
+ .float16Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -1.1470303535461426f, -0.22940611839294434f, -0.22940611839294434f, 1.6058423519134521f, 0.9999500513076782f, -0.9999500513076782f, -0.9999500513076782f, 0.9999500513076782f, -0.7337929010391235f, 0.5241377353668213f, -1.1531031131744385f, 1.3627581596374512f}}},
// int -> BOOL8 map
.bool8Operands = {},
// int -> QUANT8_SYMM_PER_CHANNEL map
@@ -375,7 +375,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nhwc = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {0.0f, -0.499996f, 0.0f, -0.0999992f, 0.0f, -0.0999992f, 0.0f, 0.6999944f, 0.99995f, -0.6999944f, -0.99995f, 0.499996f, -0.99995f, -1.0999912f, 0.99995f, 1.2999896f}}},
+ .float32Operands = {{0, {0.0f, -1.1470304f, 0.0f, -0.22940612f, 0.0f, -0.22940612f, 0.0f, 1.6058424f, 0.99995005f, -0.7337929f, -0.99995005f, 0.52413774f, -0.99995005f, -1.1531031f, 0.99995005f, 1.3627582f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -432,7 +432,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nhwc_relaxed
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {0.0f, -0.499996f, 0.0f, -0.0999992f, 0.0f, -0.0999992f, 0.0f, 0.6999944f, 0.99995f, -0.6999944f, -0.99995f, 0.499996f, -0.99995f, -1.0999912f, 0.99995f, 1.2999896f}}},
+ .float32Operands = {{0, {0.0f, -1.1470304f, 0.0f, -0.22940612f, 0.0f, -0.22940612f, 0.0f, 1.6058424f, 0.99995005f, -0.7337929f, -0.99995005f, 0.52413774f, -0.99995005f, -1.1531031f, 0.99995005f, 1.3627582f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -497,7 +497,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nhwc_float16
// int -> QUANT16_SYMM map
.quant16SymmOperands = {},
// int -> FLOAT16 map
- .float16Operands = {{0, {0.0f, -0.49999600648880005f, 0.0f, -0.09999919682741165f, 0.0f, -0.09999919682741165f, 0.0f, 0.6999943852424622f, 0.9999499917030334f, -0.6999943852424622f, -0.9999499917030334f, 0.49999600648880005f, -0.9999499917030334f, -1.0999912023544312f, 0.9999499917030334f, 1.2999895811080933f}}},
+ .float16Operands = {{0, {0.0f, -1.1470303535461426f, 0.0f, -0.22940611839294434f, 0.0f, -0.22940611839294434f, 0.0f, 1.6058423519134521f, 0.9999500513076782f, -0.7337929010391235f, -0.9999500513076782f, 0.5241377353668213f, -0.9999500513076782f, -1.1531031131744385f, 0.9999500513076782f, 1.3627581596374512f}}},
// int -> BOOL8 map
.bool8Operands = {},
// int -> QUANT8_SYMM_PER_CHANNEL map
@@ -546,7 +546,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nchw = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -0.499996f, -0.0999992f, -0.0999992f, 0.6999944f, 0.99995f, -0.99995f, -0.99995f, 0.99995f, -0.6999944f, 0.499996f, -1.0999912f, 1.2999896f}}},
+ .float32Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -1.1470304f, -0.22940612f, -0.22940612f, 1.6058424f, 0.99995005f, -0.99995005f, -0.99995005f, 0.99995005f, -0.7337929f, 0.52413774f, -1.1531031f, 1.3627582f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -603,7 +603,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nchw_relaxed
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -0.499996f, -0.0999992f, -0.0999992f, 0.6999944f, 0.99995f, -0.99995f, -0.99995f, 0.99995f, -0.6999944f, 0.499996f, -1.0999912f, 1.2999896f}}},
+ .float32Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -1.1470304f, -0.22940612f, -0.22940612f, 1.6058424f, 0.99995005f, -0.99995005f, -0.99995005f, 0.99995005f, -0.7337929f, 0.52413774f, -1.1531031f, 1.3627582f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -668,7 +668,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nchw_float16
// int -> QUANT16_SYMM map
.quant16SymmOperands = {},
// int -> FLOAT16 map
- .float16Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -0.49999600648880005f, -0.09999919682741165f, -0.09999919682741165f, 0.6999943852424622f, 0.9999499917030334f, -0.9999499917030334f, -0.9999499917030334f, 0.9999499917030334f, -0.6999943852424622f, 0.49999600648880005f, -1.0999912023544312f, 1.2999895811080933f}}},
+ .float16Operands = {{0, {0.0f, 0.0f, 0.0f, 0.0f, -1.1470303535461426f, -0.22940611839294434f, -0.22940611839294434f, 1.6058423519134521f, 0.9999500513076782f, -0.9999500513076782f, -0.9999500513076782f, 0.9999500513076782f, -0.7337929010391235f, 0.5241377353668213f, -1.1531031131744385f, 1.3627581596374512f}}},
// int -> BOOL8 map
.bool8Operands = {},
// int -> QUANT8_SYMM_PER_CHANNEL map
@@ -717,7 +717,7 @@ static std::vector<MixedTypedExample> examples_nhwc_2 = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {10.0f, 9.000008f, 10.0f, 9.8000016f, 10.0f, 9.8000016f, 10.0f, 11.3999888f, 11.9999f, 8.6000112f, 8.0001f, 10.999992f, 8.0001f, 7.8000176f, 11.9999f, 12.5999792f}}},
+ .float32Operands = {{0, {10.0f, 7.7059393f, 10.0f, 9.541187f, 10.0f, 9.541187f, 10.0f, 13.211685f, 11.9999f, 8.532414f, 8.0001f, 11.048275f, 8.0001f, 7.693794f, 11.9999f, 12.725516f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -774,7 +774,7 @@ static std::vector<MixedTypedExample> examples_nhwc_relaxed_2 = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {10.0f, 9.000008f, 10.0f, 9.8000016f, 10.0f, 9.8000016f, 10.0f, 11.3999888f, 11.9999f, 8.6000112f, 8.0001f, 10.999992f, 8.0001f, 7.8000176f, 11.9999f, 12.5999792f}}},
+ .float32Operands = {{0, {10.0f, 7.7059393f, 10.0f, 9.541187f, 10.0f, 9.541187f, 10.0f, 13.211685f, 11.9999f, 8.532414f, 8.0001f, 11.048275f, 8.0001f, 7.693794f, 11.9999f, 12.725516f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -839,7 +839,7 @@ static std::vector<MixedTypedExample> examples_nhwc_float16_2 = {
// int -> QUANT16_SYMM map
.quant16SymmOperands = {},
// int -> FLOAT16 map
- .float16Operands = {{0, {10.0f, 9.000007629394531f, 10.0f, 9.80000114440918f, 10.0f, 9.80000114440918f, 10.0f, 11.399989128112793f, 11.999899864196777f, 8.600010871887207f, 8.000100135803223f, 10.999992370605469f, 8.000100135803223f, 7.800017833709717f, 11.999899864196777f, 12.599979400634766f}}},
+ .float16Operands = {{0, {10.0f, 7.705939292907715f, 10.0f, 9.541187286376953f, 10.0f, 9.541187286376953f, 10.0f, 13.211685180664062f, 11.999899864196777f, 8.532414436340332f, 8.000100135803223f, 11.048274993896484f, 8.000100135803223f, 7.693793773651123f, 11.999899864196777f, 12.725516319274902f}}},
// int -> BOOL8 map
.bool8Operands = {},
// int -> QUANT8_SYMM_PER_CHANNEL map
@@ -888,7 +888,7 @@ static std::vector<MixedTypedExample> examples_nchw_2 = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 9.000008f, 9.8000016f, 9.8000016f, 11.3999888f, 11.9999f, 8.0001f, 8.0001f, 11.9999f, 8.6000112f, 10.999992f, 7.8000176f, 12.5999792f}}},
+ .float32Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 7.7059393f, 9.541187f, 9.541187f, 13.211685f, 11.9999f, 8.0001f, 8.0001f, 11.9999f, 8.532414f, 11.048275f, 7.693794f, 12.725516f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -945,7 +945,7 @@ static std::vector<MixedTypedExample> examples_nchw_relaxed_2 = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 9.000008f, 9.8000016f, 9.8000016f, 11.3999888f, 11.9999f, 8.0001f, 8.0001f, 11.9999f, 8.6000112f, 10.999992f, 7.8000176f, 12.5999792f}}},
+ .float32Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 7.7059393f, 9.541187f, 9.541187f, 13.211685f, 11.9999f, 8.0001f, 8.0001f, 11.9999f, 8.532414f, 11.048275f, 7.693794f, 12.725516f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -1010,7 +1010,7 @@ static std::vector<MixedTypedExample> examples_nchw_float16_2 = {
// int -> QUANT16_SYMM map
.quant16SymmOperands = {},
// int -> FLOAT16 map
- .float16Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 9.000007629394531f, 9.80000114440918f, 9.80000114440918f, 11.399989128112793f, 11.999899864196777f, 8.000100135803223f, 8.000100135803223f, 11.999899864196777f, 8.600010871887207f, 10.999992370605469f, 7.800017833709717f, 12.599979400634766f}}},
+ .float16Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 7.705939292907715f, 9.541187286376953f, 9.541187286376953f, 13.211685180664062f, 11.999899864196777f, 8.000100135803223f, 8.000100135803223f, 11.999899864196777f, 8.532414436340332f, 11.048274993896484f, 7.693793773651123f, 12.725516319274902f}}},
// int -> BOOL8 map
.bool8Operands = {},
// int -> QUANT8_SYMM_PER_CHANNEL map
@@ -1059,7 +1059,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nhwc_2 = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {10.0f, 9.000008f, 10.0f, 9.8000016f, 10.0f, 9.8000016f, 10.0f, 11.3999888f, 11.9999f, 8.6000112f, 8.0001f, 10.999992f, 8.0001f, 7.8000176f, 11.9999f, 12.5999792f}}},
+ .float32Operands = {{0, {10.0f, 7.7059393f, 10.0f, 9.541187f, 10.0f, 9.541187f, 10.0f, 13.211685f, 11.9999f, 8.532414f, 8.0001f, 11.048275f, 8.0001f, 7.693794f, 11.9999f, 12.725516f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -1116,7 +1116,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nhwc_relaxed
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {10.0f, 9.000008f, 10.0f, 9.8000016f, 10.0f, 9.8000016f, 10.0f, 11.3999888f, 11.9999f, 8.6000112f, 8.0001f, 10.999992f, 8.0001f, 7.8000176f, 11.9999f, 12.5999792f}}},
+ .float32Operands = {{0, {10.0f, 7.7059393f, 10.0f, 9.541187f, 10.0f, 9.541187f, 10.0f, 13.211685f, 11.9999f, 8.532414f, 8.0001f, 11.048275f, 8.0001f, 7.693794f, 11.9999f, 12.725516f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -1181,7 +1181,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nhwc_float16
// int -> QUANT16_SYMM map
.quant16SymmOperands = {},
// int -> FLOAT16 map
- .float16Operands = {{0, {10.0f, 9.000007629394531f, 10.0f, 9.80000114440918f, 10.0f, 9.80000114440918f, 10.0f, 11.399989128112793f, 11.999899864196777f, 8.600010871887207f, 8.000100135803223f, 10.999992370605469f, 8.000100135803223f, 7.800017833709717f, 11.999899864196777f, 12.599979400634766f}}},
+ .float16Operands = {{0, {10.0f, 7.705939292907715f, 10.0f, 9.541187286376953f, 10.0f, 9.541187286376953f, 10.0f, 13.211685180664062f, 11.999899864196777f, 8.532414436340332f, 8.000100135803223f, 11.048274993896484f, 8.000100135803223f, 7.693793773651123f, 11.999899864196777f, 12.725516319274902f}}},
// int -> BOOL8 map
.bool8Operands = {},
// int -> QUANT8_SYMM_PER_CHANNEL map
@@ -1230,7 +1230,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nchw_2 = {
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 9.000008f, 9.8000016f, 9.8000016f, 11.3999888f, 11.9999f, 8.0001f, 8.0001f, 11.9999f, 8.6000112f, 10.999992f, 7.8000176f, 12.5999792f}}},
+ .float32Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 7.7059393f, 9.541187f, 9.541187f, 13.211685f, 11.9999f, 8.0001f, 8.0001f, 11.9999f, 8.532414f, 11.048275f, 7.693794f, 12.725516f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -1287,7 +1287,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nchw_relaxed
// int -> Dimensions map
.operandDimensions = {{0, {2, 2, 2, 2}}},
// int -> FLOAT32 map
- .float32Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 9.000008f, 9.8000016f, 9.8000016f, 11.3999888f, 11.9999f, 8.0001f, 8.0001f, 11.9999f, 8.6000112f, 10.999992f, 7.8000176f, 12.5999792f}}},
+ .float32Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 7.7059393f, 9.541187f, 9.541187f, 13.211685f, 11.9999f, 8.0001f, 8.0001f, 11.9999f, 8.532414f, 11.048275f, 7.693794f, 12.725516f}}},
// int -> INT32 map
.int32Operands = {},
// int -> QUANT8_ASYMM map
@@ -1352,7 +1352,7 @@ static std::vector<MixedTypedExample> examples_dynamic_output_shape_nchw_float16
// int -> QUANT16_SYMM map
.quant16SymmOperands = {},
// int -> FLOAT16 map
- .float16Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 9.000007629394531f, 9.80000114440918f, 9.80000114440918f, 11.399989128112793f, 11.999899864196777f, 8.000100135803223f, 8.000100135803223f, 11.999899864196777f, 8.600010871887207f, 10.999992370605469f, 7.800017833709717f, 12.599979400634766f}}},
+ .float16Operands = {{0, {10.0f, 10.0f, 10.0f, 10.0f, 7.705939292907715f, 9.541187286376953f, 9.541187286376953f, 13.211685180664062f, 11.999899864196777f, 8.000100135803223f, 8.000100135803223f, 11.999899864196777f, 8.532414436340332f, 11.048274993896484f, 7.693793773651123f, 12.725516319274902f}}},
// int -> BOOL8 map
.bool8Operands = {},
// int -> QUANT8_SYMM_PER_CHANNEL map
diff --git a/nn/runtime/test/specs/V1_2/instance_normalization.mod.py b/nn/runtime/test/specs/V1_2/instance_normalization.mod.py
index 9d540ff59..48722e94d 100644
--- a/nn/runtime/test/specs/V1_2/instance_normalization.mod.py
+++ b/nn/runtime/test/specs/V1_2/instance_normalization.mod.py
@@ -28,10 +28,10 @@ Example({
1, -1, -1, 2, -1, -2, 1, 4
],
o1: [
- 0.00, -0.499996, 0.00, -0.0999992,
- 0.00, -0.0999992, 0.00, 0.6999944,
- 0.99995, -0.6999944, -0.99995, 0.499996,
- -0.99995, -1.0999912, 0.99995, 1.2999896
+ 0., -1.1470304, 0., -0.22940612,
+ 0., -0.22940612, 0., 1.6058424,
+ 0.99995005, -0.7337929, -0.99995005, 0.52413774,
+ -0.99995005, -1.1531031, 0.99995005, 1.3627582
]
}).AddNchw(i1, o1, layout).AddVariations("relaxed", "float16")
@@ -48,9 +48,9 @@ Example({
1, -1, -1, 2, -1, -2, 1, 4
],
o2: [
- 10. , 9.000008 , 10. , 9.8000016, 10. ,
- 9.8000016, 10. , 11.3999888, 11.9999 , 8.6000112,
- 8.0001 , 10.999992 , 8.0001 , 7.8000176, 11.9999 ,
- 12.5999792
+ 10., 7.7059393, 10., 9.541187,
+ 10., 9.541187, 10., 13.211685,
+ 11.9999, 8.532414, 8.0001, 11.048275,
+ 8.0001, 7.693794, 11.9999, 12.725516
]
}).AddNchw(i2, o2, layout).AddVariations("relaxed", "float16")