ArmNN
 21.05
RefGatherWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd and Contributors. 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"
11 #include <ResolveType.hpp>
12 
13 namespace armnn
14 {
15 
17 {
19 }
20 
22 {
23  Execute(workingMemDescriptor.m_Inputs, workingMemDescriptor.m_Outputs);
24 }
25 
26 void RefGatherWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
27 {
28  ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefGatherWorkload_Execute");
29 
30  const TensorInfo& inputInfo0 = GetTensorInfo(inputs[0]);
31  const TensorInfo& inputInfo1 = GetTensorInfo(inputs[1]);
32  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
33 
34  std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputInfo0, inputs[0]->Map());
35  Decoder<float>& decoder = *decoderPtr;
36 
37  const int32_t* indicesData = reinterpret_cast<int32_t*>(inputs[1]->Map());
38 
39  std::unique_ptr<Encoder<float>> encoderPtr = MakeEncoder<float>(outputInfo, outputs[0]->Map());
40  Encoder<float>& encoder = *encoderPtr;
41 
42  Gather(inputInfo0, inputInfo1, outputInfo, decoder, indicesData, encoder, m_Data.m_Parameters.m_Axis);
43 }
44 
45 } //namespace armnn
CPU Execution: Reference C++ kernels.
Copyright (c) 2021 ARM Limited and Contributors.
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:173
void Execute() const override
int32_t m_Axis
The axis in params to gather indices from.
std::vector< ITensorHandle * > m_Outputs
std::vector< ITensorHandle * > m_Inputs
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
void ExecuteAsync(WorkingMemDescriptor &workingMemDescriptor) override