From 8efb48a6847c5cd166c561127ae6611150963ce3 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Fri, 19 May 2023 11:14:28 +0100 Subject: Update Doxygen docu for 23.05 Signed-off-by: Nikhil Raj Change-Id: I0a992286f14fa68fcc6e5eba31ac39fed003cbbe --- 23.05/_fully_connected_8cpp_source.xhtml | 197 +++++++++++++++++++++++++++++++ 1 file changed, 197 insertions(+) create mode 100644 23.05/_fully_connected_8cpp_source.xhtml (limited to '23.05/_fully_connected_8cpp_source.xhtml') diff --git a/23.05/_fully_connected_8cpp_source.xhtml b/23.05/_fully_connected_8cpp_source.xhtml new file mode 100644 index 0000000000..e24ee6c954 --- /dev/null +++ b/23.05/_fully_connected_8cpp_source.xhtml @@ -0,0 +1,197 @@ + + + + + + + + + + + + + +ArmNN: src/backends/reference/workloads/FullyConnected.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  23.05 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
FullyConnected.cpp
+
+
+Go to the documentation of this file.
1 //
+
2 // Copyright © 2017 Arm Ltd. All rights reserved.
+
3 // SPDX-License-Identifier: MIT
+
4 //
+
5 
+
6 #include "FullyConnected.hpp"
+
7 
+ +
9 
+
10 #include "RefWorkloadUtils.hpp"
+
11 
+
12 namespace armnn
+
13 {
+
14 
+
15 void FullyConnected(const TensorShape& rInputShape,
+
16  Decoder<float>& rInputDecoder,
+
17  const TensorShape& rOutputShape,
+
18  Encoder<float>& rOutputEncoder,
+
19  const TensorShape& rWeightsShape,
+
20  Decoder<float>& rWeightDecoder,
+
21  Decoder<float>* pBiasDecoder,
+
22  const bool biasEnabled,
+
23  const unsigned int K,
+
24  const bool transposeWeights)
+
25 {
+
26  // Perform FullyConnected implementation
+
27  unsigned int outputSize = rOutputShape[1];
+
28 
+
29  const std::vector<float> decodedInputs = rInputDecoder.DecodeTensor(rInputShape);
+
30  const std::vector<float> decodedWeights = rWeightDecoder.DecodeTensor(rWeightsShape);
+
31 
+
32  const TensorShape biasShape{outputSize};
+
33 
+
34  ARMNN_ASSERT(!biasEnabled || pBiasDecoder != nullptr);
+
35  const std::vector<float> decodedBiases = biasEnabled ? pBiasDecoder->DecodeTensor(biasShape) : std::vector<float>();
+
36 
+
37 
+
38  for (unsigned int n = 0; n < rInputShape[0]; n++)
+
39  {
+
40  for (unsigned int channelOutput = 0; channelOutput < outputSize; channelOutput++)
+
41  {
+
42  float outval = 0.f;
+
43 
+
44  for (unsigned int channelInput = 0; channelInput < K; channelInput++)
+
45  {
+
46  float weight;
+
47  if (transposeWeights)
+
48  {
+
49  weight = decodedWeights[channelOutput * K + channelInput];
+
50  }
+
51  else
+
52  {
+
53  weight = decodedWeights[channelInput * outputSize + channelOutput];
+
54  }
+
55 
+
56  outval += weight * decodedInputs[n * K + channelInput];
+
57  }
+
58 
+
59  if (biasEnabled)
+
60  {
+
61  outval += decodedBiases[channelOutput];
+
62  }
+
63 
+
64  rOutputEncoder[n * outputSize + channelOutput];
+
65  rOutputEncoder.Set(outval);
+
66  }
+
67  }
+
68 }
+
69 
+
70 } //namespace armnn
+
+
+ +
void FullyConnected(const TensorShape &rInputShape, Decoder< float > &rInputDecoder, const TensorShape &rOutputShape, Encoder< float > &rOutputEncoder, const TensorShape &rWeightsShape, Decoder< float > &rWeightDecoder, Decoder< float > *pBiasDecoder, const bool biasEnabled, const unsigned int K, const bool transposeWeights)
Performs a matrix multiplication and optionally adds a bias.
+ +
Copyright (c) 2021 ARM Limited and Contributors.
+ + + + +
virtual void Set(IType right)=0
+
#define ARMNN_ASSERT(COND)
Definition: Assert.hpp:14
+
virtual std::vector< float > DecodeTensor(const TensorShape &tensorShape, bool isDepthwise=false)=0
+ + + + -- cgit v1.2.1