ArmNN
 24.02
RefReduceWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2020 Samsung Electronics Co Ltd and Contributors. All rights reserved.
3 // Copyright © 2021-2023 Arm Ltd and Contributors. All rights reserved.
4 // SPDX-License-Identifier: MIT
5 //
6 
7 #include "RefReduceWorkload.hpp"
8 
9 #include "Reduce.hpp"
10 #include "RefWorkloadUtils.hpp"
11 #include "BaseIterator.hpp"
12 #include "Profiling.hpp"
13 
14 namespace armnn
15 {
16 
18  const ReduceQueueDescriptor& descriptor,
19  const WorkloadInfo& info)
20  : RefBaseWorkload<ReduceQueueDescriptor>(descriptor, info) {}
21 
23 {
25 }
26 
28 {
29  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
30  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
31 }
32 
33 void RefReduceWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
34 {
35  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefReduceWorkload_Execute");
36 
37  const TensorInfo& inputInfo = GetTensorInfo(inputs[0]);
38  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
39 
40  std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputInfo, inputs[0]->Map());
41  Decoder<float>& decoder = *decoderPtr;
42 
43  std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputInfo, outputs[0]->Map());
44  Encoder<float>& encoder = *encoderPtr;
45 
46  Reduce(inputInfo,
47  outputInfo,
48  decoder,
49  encoder,
52 }
53 
54 } //namespace armnn
armnn::Decoder< float >
BaseIterator.hpp
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
armnn::TensorInfo
Definition: Tensor.hpp:152
armnn::Reduce
void Reduce(const TensorInfo &inputInfo, const TensorInfo &outputInfo, Decoder< float > &input, Encoder< float > &output, const std::vector< uint32_t > axis, const ReduceOperation reduceOperation)
Definition: Reduce.cpp:70
Profiling.hpp
ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: RefWorkloadUtils.hpp:22
RefReduceWorkload.hpp
armnn::ReduceDescriptor::m_ReduceOperation
ReduceOperation m_ReduceOperation
Specifies the reduction operation to execute.
Definition: Descriptors.hpp:1558
armnn::Encoder< float >
armnn::ReduceQueueDescriptor
Definition: WorkloadData.hpp:686
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::WorkloadInfo
Contains information about TensorInfos of a layer.
Definition: WorkloadInfo.hpp:16
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::BoostLogSeverityMapping::info
@ info
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::RefReduceWorkload::RefReduceWorkload
RefReduceWorkload(const ReduceQueueDescriptor &descriptor, const WorkloadInfo &info)
Definition: RefReduceWorkload.cpp:17
armnn::RefReduceWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefReduceWorkload.cpp:27
RefWorkloadUtils.hpp
armnn::BaseWorkload< ReduceQueueDescriptor >::m_Data
ReduceQueueDescriptor m_Data
Definition: Workload.hpp:89
armnn::RefReduceWorkload::Execute
void Execute() const override
Definition: RefReduceWorkload.cpp:22
armnn::ReduceDescriptor::m_vAxis
std::vector< uint32_t > m_vAxis
The indices of the dimensions to reduce.
Definition: Descriptors.hpp:1556
Reduce.hpp
armnn::LayerType::Map
@ Map
armnn::experimental::WorkingMemDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkingMemDescriptor.hpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
armnn::RefBaseWorkload
Definition: RefBaseWorkload.hpp:13
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkingMemDescriptor.hpp:21
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14