ArmNN
 24.08
RefPadWorkload.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2018-2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "RefPadWorkload.hpp"
7 
8 #include "MirrorPad.hpp"
9 #include "Pad.hpp"
10 #include "Profiling.hpp"
11 #include "RefWorkloadUtils.hpp"
12 
13 namespace armnn
14 {
15 
17 {
19 }
20 
22 {
23  WorkingMemDescriptor* workingMemDescriptor = static_cast<WorkingMemDescriptor*>(executionData.m_Data);
24  Execute(workingMemDescriptor->m_Inputs, workingMemDescriptor->m_Outputs);
25 }
26 
27 void RefPadWorkload::Execute(std::vector<ITensorHandle*> inputs, std::vector<ITensorHandle*> outputs) const
28 {
29  ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID("RefPadWorkload_Execute");
30 
31  const TensorInfo& inputInfo = GetTensorInfo(inputs[0]);
32  const TensorInfo& outputInfo = GetTensorInfo(outputs[0]);
33 
35  if (paddingMode == PaddingMode::Constant)
36  {
37  armnn::Pad(inputInfo, outputInfo, inputs[0], outputs[0], m_Data);
38  }
39  else if(paddingMode == PaddingMode::Reflect || paddingMode == PaddingMode::Symmetric)
40  {
41  armnn::MirrorPad(inputInfo, outputInfo, inputs[0], outputs[0], m_Data);
42  }
43  else
44  {
45  throw InvalidArgumentException("Padding mode not supported.");
46  }
47 }
48 
49 } //namespace armnn
armnn::PaddingMode::Symmetric
@ Symmetric
armnn::experimental::ExecutionData::m_Data
void * m_Data
Definition: ExecutionData.hpp:16
RefPadWorkload.hpp
armnn::TensorInfo
Definition: Tensor.hpp:152
MirrorPad.hpp
Profiling.hpp
ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID
#define ARMNN_SCOPED_PROFILING_EVENT_REF_NAME_GUID(label)
Creates a profiling event that uses GetGuid() and GetName() from the calling class.
Definition: RefWorkloadUtils.hpp:22
armnn::PaddingMode
PaddingMode
The padding mode controls whether the padding should be filled with constant values (Constant),...
Definition: Types.hpp:200
armnn::QueueDescriptorWithParameters::m_Parameters
LayerDescriptor m_Parameters
Definition: WorkloadData.hpp:66
armnn::MirrorPad
void MirrorPad(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const ITensorHandle *inputHandle, ITensorHandle *outputHandle, const PadQueueDescriptor &data)
Definition: MirrorPad.cpp:59
armnn::RefPadWorkload::ExecuteAsync
void ExecuteAsync(ExecutionData &executionData) override
Definition: RefPadWorkload.cpp:21
armnn::GetTensorInfo
const TensorInfo & GetTensorInfo(const ITensorHandle *tensorHandle)
float32 helpers
Definition: RefWorkloadUtils.hpp:33
armnn::QueueDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkloadData.hpp:27
armnn::Pad
void Pad(const TensorInfo &inputInfo, const TensorInfo &outputInfo, const ITensorHandle *inputHandle, ITensorHandle *outputHandle, const PadQueueDescriptor &data)
Definition: Pad.cpp:39
RefWorkloadUtils.hpp
armnn::RefPadWorkload::Execute
void Execute() const override
Definition: RefPadWorkload.cpp:16
armnn::BaseWorkload< PadQueueDescriptor >::m_Data
PadQueueDescriptor m_Data
Definition: Workload.hpp:89
Pad.hpp
armnn::experimental::WorkingMemDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkingMemDescriptor.hpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::experimental::WorkingMemDescriptor
Definition: WorkingMemDescriptor.hpp:18
armnn::PadDescriptor::m_PaddingMode
PaddingMode m_PaddingMode
Specifies the Padding mode (Constant, Reflect or Symmetric)
Definition: Descriptors.hpp:1224
armnn::PaddingMode::Reflect
@ Reflect
armnn::PaddingMode::Constant
@ Constant
armnn::experimental::WorkingMemDescriptor::m_Outputs
std::vector< ITensorHandle * > m_Outputs
Definition: WorkingMemDescriptor.hpp:21
armnn::QueueDescriptor::m_Inputs
std::vector< ITensorHandle * > m_Inputs
Definition: WorkloadData.hpp:26
armnn::experimental::ExecutionData
Definition: ExecutionData.hpp:14