ArmNN
 24.02
RefFloorWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "RefFloorWorkload.hpp"
7 
8 #include "Decoders.hpp"
9 #include "Encoders.hpp"
10 #include "RefWorkloadUtils.hpp"
11 #include "Profiling.hpp"
12 
13 namespace armnn
14 {
15 
17 {
19 }
20 
22 {
23  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
24  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
25 }
26 
27 void RefFloorWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
28 {
29  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefFloatWorkload_Execute");
30 
31  const TensorInfo &inputTensorInfo = GetTensorInfo(inputs[0]);
32  std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputTensorInfo, inputs[0]->Map());
33  Decoder<float> &decoder = *decoderPtr;
34 
35  const TensorInfo &outputTensorInfo = GetTensorInfo(outputs[0]);
36  std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputTensorInfo, outputs[0]->Map());
37  Encoder<float> &encoder = *encoderPtr;
38 
39  unsigned int numElements = GetTensorInfo(inputs[0]).GetNumElements();
40 
41  for (unsigned int i = 0; i < numElements; ++i)
42  {
43  encoder.Set(floorf(decoder.Get()));
44  ++decoder;
45  ++encoder;
46  }
47 }
48 
49 } //namespace armnn
armnn::Decoder< float >
armnn::TensorInfo::GetNumElements
unsigned int GetNumElements() const
Definition: Tensor.hpp:198
armnn::Encoder::Set
virtual void Set(IType right)=0
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
armnn::RefFloorWorkload::Execute
void Execute() const override
Definition: RefFloorWorkload.cpp:16
armnn::TensorInfo
Definition: Tensor.hpp:152
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
armnn::Encoder< float >
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::RefFloorWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefFloorWorkload.cpp:21
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::Decoder::Get
virtual IType Get() const =0
RefFloorWorkload.hpp
RefWorkloadUtils.hpp
armnn::BaseWorkload< FloorQueueDescriptor >::m_Data
FloorQueueDescriptor m_Data
Definition: Workload.hpp:89
Decoders.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
Encoders.hpp
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