IVGCVSW-3642 Fixed VTS Test Failures
authorMike Kelly <mike.kelly@arm.com>
Wed, 21 Aug 2019 08:36:58 +0000 (09:36 +0100)
committerMike Kelly <mike.kelly@arm.com>
Wed, 21 Aug 2019 08:36:58 +0000 (09:36 +0100)
 * Fixed Quant8 VTS test failures where an output value should have been greater than 255 before a negative bias was applied.

Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Change-Id: Ie0084c1c8c4a4b5f069112d523765ed338277e58

src/backends/reference/workloads/TransposeConvolution2d.cpp

index 52cc18c..1b89ef9 100644 (file)
@@ -49,12 +49,7 @@ void TransposeConvolution2dImpl(const TransposeConvolution2dDescriptor& descript
     unsigned int strideX = descriptor.m_StrideX;
     unsigned int strideY = descriptor.m_StrideY;
 
-    // Set the initial output values to be logically 0 otherwise the algorithm doesn't work.
-    for (unsigned int i = 0u; i < outputShape.GetNumElements(); ++i)
-    {
-        outputEncoder.Set(0.f);
-        ++outputEncoder;
-    }
+    std::vector<float> outputBuffer(outputShape.GetNumElements(), 0);
 
     for (unsigned int batch = 0u; batch < numBatches; ++batch)
     {
@@ -90,10 +85,9 @@ void TransposeConvolution2dImpl(const TransposeConvolution2dDescriptor& descript
                                         dataLayoutIndexed.GetIndex(outputShape, batch, dOutput, yOutput, xOutput);
                                     outputEncoder[outputIndex];
 
-                                    float output = outputEncoder.Get();
+                                    float output = outputBuffer[outputIndex];
                                     output += inputDecoder.Get() * weightsDecoder.Get();
-
-                                    outputEncoder.Set(output);
+                                    outputBuffer[outputIndex] = output;
                                 }
                             }
                         }
@@ -120,14 +114,18 @@ void TransposeConvolution2dImpl(const TransposeConvolution2dDescriptor& descript
                     {
                         const unsigned int outputIndex =
                             dataLayoutIndexed.GetIndex(outputShape, batch, dOutput, yOutput, xOutput);
-
-                        outputEncoder[outputIndex];
-                        outputEncoder.Set(outputEncoder.Get() + rBiasesDecoder.Get());
+                        outputBuffer[outputIndex] += rBiasesDecoder.Get();
                     }
                 }
             }
         }
     }
+    outputEncoder[0];
+    for (float output : outputBuffer)
+    {
+        outputEncoder.Set(output);
+        ++outputEncoder;
+    }
 }
 
 } // namespace armnn