ArmNN
 21.05
RefArgMinMaxWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2019 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include "ArgMinMax.hpp"
9 #include "RefWorkloadUtils.hpp"
10 #include "Decoders.hpp"
11 #include "Encoders.hpp"
12 #include "Profiling.hpp"
13 
14 namespace armnn
15 {
17  const ArgMinMaxQueueDescriptor& descriptor,
18  const WorkloadInfo& info)
19  : BaseWorkload<ArgMinMaxQueueDescriptor>(descriptor, info) {}
20 
21 
23 {
25 }
26 
28 {
29  Execute(workingMemDescriptor.m_Inputs, workingMemDescriptor.m_Outputs);
30 }
31 
32 void RefArgMinMaxWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
33 {
34  ARMNN_SCOPED_PROFILING_EVENT(Compute::CpuRef, "RefArgMinMaxWorkload_Execute");
35 
36  const TensorInfo &inputTensorInfo = GetTensorInfo(inputs[0]);
37 
38  std::unique_ptr<Decoder<float>> decoderPtr = MakeDecoder<float>(inputTensorInfo, inputs[0]->Map());
39  Decoder<float> &decoder = *decoderPtr;
40 
41  const TensorInfo &outputTensorInfo = GetTensorInfo(outputs[0]);
42 
43  if (outputTensorInfo.GetDataType() == armnn::DataType::Signed32) {
44  int32_t *output = GetOutputTensorData<int32_t>(outputs[0]);
45  ArgMinMax(decoder, output, inputTensorInfo, outputTensorInfo, m_Data.m_Parameters.m_Function,
47  } else {
48  int64_t *output = GetOutputTensorData<int64_t>(outputs[0]);
49  ArgMinMax(decoder, output, inputTensorInfo, outputTensorInfo, m_Data.m_Parameters.m_Function,
51  }
52 }
53 
54 } //namespace armnn
CPU Execution: Reference C++ kernels.
ArgMinMaxFunction m_Function
Specify if the function is to find Min or Max.
Definition: Descriptors.hpp:70
Copyright (c) 2021 ARM Limited and Contributors.
#define ARMNN_SCOPED_PROFILING_EVENT(backendId, name)
Definition: Profiling.hpp:173
void ExecuteAsync(WorkingMemDescriptor &workingMemDescriptor) override
DataType GetDataType() const
Definition: Tensor.hpp:194
std::vector< ITensorHandle * > m_Outputs
RefArgMinMaxWorkload(const ArgMinMaxQueueDescriptor &descriptor, const WorkloadInfo &info)
Contains information about inputs and outputs to a layer.
int m_Axis
Axis to reduce across the input tensor.
Definition: Descriptors.hpp:72
std::vector< ITensorHandle * > m_Inputs
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers