aboutsummaryrefslogtreecommitdiff
path: root/src/backends/reference/workloads/FullyConnected.cpp
diff options
context:
space:
mode:
authorMatthew Bentham <matthew.bentham@arm.com>2021-07-07 09:08:48 +0100
committerMatthew Bentham <matthew.bentham@arm.com>2021-07-16 15:43:54 +0000
commit18bf43d9caeb7f482e0beaef45202b6638d48a8c (patch)
tree81edfa19c9a44f100e2fe814a097ae95c7ca36e4 /src/backends/reference/workloads/FullyConnected.cpp
parent94df84d1e4964f00fbeaa29a720ef1822ba033d6 (diff)
downloadarmnn-18bf43d9caeb7f482e0beaef45202b6638d48a8c.tar.gz
Fix binding of reference to null pointer in RefFullyConnectedWorkload
As the bias decoder is optional, pass it as a pointer to the FullyConnected function instead of by reference. Signed-off-by: Matthew Bentham <matthew.bentham@arm.com> Change-Id: I0bd2e601015e7fa1ae21b50f6c3dd7eac4176554
Diffstat (limited to 'src/backends/reference/workloads/FullyConnected.cpp')
-rw-r--r--src/backends/reference/workloads/FullyConnected.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/backends/reference/workloads/FullyConnected.cpp b/src/backends/reference/workloads/FullyConnected.cpp
index 9ec9ea6c6c..47968f4d88 100644
--- a/src/backends/reference/workloads/FullyConnected.cpp
+++ b/src/backends/reference/workloads/FullyConnected.cpp
@@ -5,6 +5,8 @@
#include "FullyConnected.hpp"
+#include <armnn/utility/Assert.hpp>
+
#include "RefWorkloadUtils.hpp"
namespace armnn
@@ -16,7 +18,7 @@ void FullyConnected(const TensorShape& rInputShape,
Encoder<float>& rOutputEncoder,
const TensorShape& rWeightsShape,
Decoder<float>& rWeightDecoder,
- Decoder<float>& rBiasDecoder,
+ Decoder<float>* pBiasDecoder,
const bool biasEnabled,
const unsigned int K,
const bool transposeWeights)
@@ -28,7 +30,9 @@ void FullyConnected(const TensorShape& rInputShape,
const std::vector<float> decodedWeights = rWeightDecoder.DecodeTensor(rWeightsShape);
const TensorShape biasShape{outputSize};
- const std::vector<float> decodedBiases = biasEnabled ? rBiasDecoder.DecodeTensor(biasShape) : std::vector<float>();
+
+ ARMNN_ASSERT(!biasEnabled || pBiasDecoder != nullptr);
+ const std::vector<float> decodedBiases = biasEnabled ? pBiasDecoder->DecodeTensor(biasShape) : std::vector<float>();
for (unsigned int n = 0; n < rInputShape[0]; n++)