blob: d96b18b530fc66bd4de3b55d9dfc7dcec49e4ec9 [file] [log] [blame]
James Conroy83735b12019-05-30 16:36:59 +01001//
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
13namespace armnn
14{
15
16void RefFloorWorkload::Execute() const
17{
18 ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefFloorFloat32Workload_Execute");
19
20 const TensorInfo &inputTensorInfo = GetTensorInfo(m_Data.m_Inputs[0]);
21 std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputTensorInfo, m_Data.m_Inputs[0]->Map());
22 Decoder<float> &decoder = *decoderPtr;
23
24 const TensorInfo &outputTensorInfo = GetTensorInfo(m_Data.m_Outputs[0]);
25 std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputTensorInfo, m_Data.m_Outputs[0]->Map());
26 Encoder<float> &encoder = *encoderPtr;
27
28 unsigned int numElements = GetTensorInfo(m_Data.m_Inputs[0]).GetNumElements();
29
30 for (unsigned int i = 0; i < numElements; ++i)
31 {
32 encoder.Set(floorf(decoder.Get()));
33 ++decoder;
34 ++encoder;
35 }
36}
37
38} //namespace armnn