narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "RefGatherWorkload.hpp" |
| 7 | |
| 8 | #include "Gather.hpp" |
| 9 | #include "Profiling.hpp" |
| 10 | #include "RefWorkloadUtils.hpp" |
Aron Virginas-Tar | d4f0fea | 2019-04-09 14:08:06 +0100 | [diff] [blame] | 11 | #include <ResolveType.hpp> |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 12 | |
| 13 | namespace armnn |
| 14 | { |
| 15 | |
Ellen Norris-Thompson | 6858d3f | 2019-06-21 15:50:00 +0100 | [diff] [blame] | 16 | void RefGatherWorkload::Execute() const |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 17 | { |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 18 | ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefGatherWorkload_Execute"); |
| 19 | |
| 20 | const TensorInfo& inputInfo0 = GetTensorInfo(m_Data.m_Inputs[0]); |
| 21 | const TensorInfo& inputInfo1 = GetTensorInfo(m_Data.m_Inputs[1]); |
| 22 | const TensorInfo& outputInfo = GetTensorInfo(m_Data.m_Outputs[0]); |
| 23 | |
Ellen Norris-Thompson | 6858d3f | 2019-06-21 15:50:00 +0100 | [diff] [blame] | 24 | std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputInfo0, m_Data.m_Inputs[0]->Map()); |
| 25 | Decoder<float>& decoder = *decoderPtr; |
| 26 | |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 27 | const int32_t* indicesData = GetInputTensorData<int32_t>(1, m_Data); |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 28 | |
Ellen Norris-Thompson | 6858d3f | 2019-06-21 15:50:00 +0100 | [diff] [blame] | 29 | std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputInfo, m_Data.m_Outputs[0]->Map()); |
| 30 | Encoder<float>& encoder = *encoderPtr; |
| 31 | |
| 32 | Gather(inputInfo0, inputInfo1, outputInfo, decoder, indicesData, encoder); |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 33 | } |
| 34 | |
narpra01 | 4951d84 | 2019-01-18 16:53:53 +0000 | [diff] [blame] | 35 | } //namespace armnn |