ArmNN
 22.05
RefFloorWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. 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  Execute(workingMemDescriptor.m_Inputs, workingMemDescriptor.m_Outputs);
24 }
25 
26 void RefFloorWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
27 {
28  ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefFloorFloat32Workload_Execute");
29 
30  const TensorInfo &inputTensorInfo = GetTensorInfo(inputs[0]);
31  std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputTensorInfo, inputs[0]->Map());
32  Decoder<float> &decoder = *decoderPtr;
33 
34  const TensorInfo &outputTensorInfo = GetTensorInfo(outputs[0]);
35  std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputTensorInfo, outputs[0]->Map());
36  Encoder<float> &encoder = *encoderPtr;
37 
38  unsigned int numElements = GetTensorInfo(inputs[0]).GetNumElements();
39 
40  for (unsigned int i = 0; i < numElements; ++i)
41  {
42  encoder.Set(floorf(decoder.Get()));
43  ++decoder;
44  ++encoder;
45  }
46 }
47 
48 } //namespace armnn
void ExecuteAsync(WorkingMemDescriptor &workingMemDescriptor) override
CPU Execution: Reference C++ kernels.
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
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
unsigned int GetNumElements() const
Definition: Tensor.hpp:196