From 6940dd720ebb6b3d1df8ca203ab696daefe58189 Mon Sep 17 00:00:00 2001 From: Jim Flynn Date: Fri, 20 Mar 2020 12:25:56 +0000 Subject: renamed Documentation folder 20.02 and added .nojekyll file Signed-off-by: Jim Flynn --- ...neon_fully_connected_workload_8cpp_source.xhtml | 145 +++++++++++++++++++++ 1 file changed, 145 insertions(+) create mode 100644 20.02/_neon_fully_connected_workload_8cpp_source.xhtml (limited to '20.02/_neon_fully_connected_workload_8cpp_source.xhtml') diff --git a/20.02/_neon_fully_connected_workload_8cpp_source.xhtml b/20.02/_neon_fully_connected_workload_8cpp_source.xhtml new file mode 100644 index 0000000000..63bfb34df1 --- /dev/null +++ b/20.02/_neon_fully_connected_workload_8cpp_source.xhtml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + +ArmNN: src/backends/neon/workloads/NeonFullyConnectedWorkload.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  20.02 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
NeonFullyConnectedWorkload.cpp
+
+
+Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "NeonWorkloadUtils.hpp"
12 
13 #include <arm_compute/runtime/NEON/functions/NEFullyConnectedLayer.h>
14 
15 namespace armnn
16 {
17 using namespace armcomputetensorutils;
18 
20  const TensorInfo& output,
21  const TensorInfo& weights,
22  const TensorInfo& biases,
23  const FullyConnectedDescriptor& descriptor)
24 {
25  const arm_compute::TensorInfo aclInput = BuildArmComputeTensorInfo(input);
26  const arm_compute::TensorInfo aclOutput = BuildArmComputeTensorInfo(output);
27  const arm_compute::TensorInfo aclWeights = BuildArmComputeTensorInfo(weights);
28 
29  arm_compute::TensorInfo aclBiases;
30  arm_compute::TensorInfo *optionalAclBiases = nullptr;
31  if (descriptor.m_BiasEnabled)
32  {
33  aclBiases = BuildArmComputeTensorInfo(biases);
34  optionalAclBiases = &aclBiases;
35  }
36 
37  const arm_compute::FullyConnectedLayerInfo fullyConnectedLayerInfo =
39 
40 
41  return arm_compute::NEFullyConnectedLayer::validate(&aclInput,
42  &aclWeights,
43  optionalAclBiases,
44  &aclOutput,
45  fullyConnectedLayerInfo);
46 }
47 
49  const WorkloadInfo& info, std::shared_ptr<arm_compute::MemoryManagerOnDemand>& memoryManager)
50  : BaseWorkload<FullyConnectedQueueDescriptor>(descriptor, info)
51 {
52  m_Data.ValidateInputsOutputs("NeonFullyConnectedWorkload", 1, 1);
53 
54  arm_compute::ITensor& input = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
55  arm_compute::ITensor& output = boost::polymorphic_downcast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
56 
57  m_WeightsTensor = std::make_unique<arm_compute::Tensor>();
58  BuildArmComputeTensor(*m_WeightsTensor, m_Data.m_Weight->GetTensorInfo());
59 
61  {
62  m_BiasesTensor = std::make_unique<arm_compute::Tensor>();
63  BuildArmComputeTensor(*m_BiasesTensor, m_Data.m_Bias->GetTensorInfo());
64  }
65 
66  // Construct
67  arm_compute::FullyConnectedLayerInfo fc_info;
68  fc_info.transpose_weights = m_Data.m_Parameters.m_TransposeWeightMatrix;
69 
70  auto layer = std::make_unique<arm_compute::NEFullyConnectedLayer>(memoryManager);
71  layer->configure(&input, m_WeightsTensor.get(), m_BiasesTensor.get(), &output, fc_info);
72  m_FullyConnectedLayer.reset(layer.release());
73 
74  // Allocate
76  {
78  }
79  else
80  {
82  }
83 
84  if (m_BiasesTensor)
85  {
87  {
89  }
90  else
91  {
93  }
94  }
95 
96  // Force Compute Library to perform the necessary copying and reshaping, after which
97  // delete all the input tensors that will no longer be needed
98  m_FullyConnectedLayer->prepare();
99  FreeUnusedTensors();
100 }
101 
103 {
104  ARMNN_SCOPED_PROFILING_EVENT_NEON("NeonFullyConnectedWorkload_Execute");
105  m_FullyConnectedLayer->run();
106 }
107 
108 void NeonFullyConnectedWorkload::FreeUnusedTensors()
109 {
110  FreeTensorIfUnused(m_WeightsTensor);
111  FreeTensorIfUnused(m_BiasesTensor);
112 }
113 
114 } //namespace armnn
+
const ConstCpuTensorHandle * m_Weight
+ +
bool m_TransposeWeightMatrix
Enable/disable transpose weight matrix.
+ +
const FullyConnectedQueueDescriptor m_Data
Definition: Workload.hpp:46
+
#define ARMNN_SCOPED_PROFILING_EVENT_NEON(name)
+ +
NeonFullyConnectedWorkload(const FullyConnectedQueueDescriptor &descriptor, const WorkloadInfo &info, std::shared_ptr< arm_compute::MemoryManagerOnDemand > &memoryManager)
+
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
+
Copyright (c) 2020 ARM Limited.
+ + + +
arm_compute::FullyConnectedLayerInfo ConvertFullyConnectedDescriptorToAclFullyConnectedLayerInfo(const FullyConnectedDescriptor &fullyConnectedDesc)
+
DataType GetDataType() const
Definition: Tensor.hpp:95
+ +
A FullyConnectedDescriptor for the FullyConnectedLayer.
+
bool m_BiasEnabled
Enable/disable bias.
+
Status
enumeration
Definition: Types.hpp:26
+
arm_compute::Status NeonFullyConnectedWorkloadValidate(const TensorInfo &input, const TensorInfo &output, const TensorInfo &weights, const TensorInfo &biases, const FullyConnectedDescriptor &descriptor)
+ + +
void InitializeArmComputeTensorData(arm_compute::Tensor &tensor, const ConstCpuTensorHandle *handle)
+ +
std::vector< ITensorHandle * > m_Outputs
+ +
Contains information about inputs and outputs to a layer.
+
std::vector< ITensorHandle * > m_Inputs
+
const ConstCpuTensorHandle * m_Bias
+ +
const TensorInfo & GetTensorInfo() const
+
+
+ + + + -- cgit v1.2.1