ArmNN
 22.11
RefFloorWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2022 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(Compute::CpuRef, "RefFloorFloat32Workload_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
CPU Execution: Reference C++ kernels.
void ExecuteAsync(ExecutionData &executionData) override
Copyright (c) 2021 ARM Limited and Contributors.
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:220
void Execute() const override
std::vector< ITensorHandle * > m_Outputs
std::vector< ITensorHandle * > m_Inputs
unsigned int GetNumElements() const
Definition: Tensor.hpp:196
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers