telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | |
| 6 | #include "RefFullyConnectedFloat32Workload.hpp" |
| 7 | |
| 8 | #include "FullyConnected.hpp" |
| 9 | #include "RefWorkloadUtils.hpp" |
| 10 | |
| 11 | #include "Profiling.hpp" |
| 12 | |
| 13 | namespace armnn |
| 14 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 15 | RefFullyConnectedFloat32Workload::RefFullyConnectedFloat32Workload( |
| 16 | const FullyConnectedQueueDescriptor& descriptor, const WorkloadInfo& info) |
| 17 | : Float32Workload<FullyConnectedQueueDescriptor>(descriptor, info), |
| 18 | m_Weight(std::make_unique<ScopedCpuTensorHandle>(*(descriptor.m_Weight))), |
| 19 | m_Bias(descriptor.m_Parameters.m_BiasEnabled |
| 20 | ? std::make_unique<ScopedCpuTensorHandle>(*(descriptor.m_Bias)) : nullptr) {} |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 21 | |
| 22 | void RefFullyConnectedFloat32Workload::Execute() const |
| 23 | { |
| 24 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefFullyConnectedFloat32Workload_Execute"); |
| 25 | |
| 26 | const TensorInfo& inputInfo = GetTensorInfo(m_Data.m_Inputs[0]); |
| 27 | const TensorInfo& outputInfo = GetTensorInfo(m_Data.m_Outputs[0]); |
| 28 | |
| 29 | float* outputData = GetOutputTensorDataFloat(0, m_Data); |
| 30 | const float* inputData = GetInputTensorDataFloat(0, m_Data); |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 31 | const float* weightData = m_Weight->GetConstTensor<float>(); |
| 32 | const float* biasData = m_Data.m_Parameters.m_BiasEnabled ? m_Bias->GetConstTensor<float>() : nullptr; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 33 | |
| 34 | FullyConnected(inputData, |
| 35 | outputData, |
| 36 | inputInfo, |
| 37 | outputInfo, |
| 38 | weightData, |
| 39 | biasData, |
| 40 | m_Data.m_Parameters.m_TransposeWeightMatrix); |
| 41 | } |
| 42 | |
| 43 | } //namespace armnn |