From 8efb48a6847c5cd166c561127ae6611150963ce3 Mon Sep 17 00:00:00 2001 From: Nikhil Raj Date: Fri, 19 May 2023 11:14:28 +0100 Subject: Update Doxygen docu for 23.05 Signed-off-by: Nikhil Raj Change-Id: I0a992286f14fa68fcc6e5eba31ac39fed003cbbe --- ...neon_channel_shuffle_workload_8cpp_source.xhtml | 241 +++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 23.05/_neon_channel_shuffle_workload_8cpp_source.xhtml (limited to '23.05/_neon_channel_shuffle_workload_8cpp_source.xhtml') diff --git a/23.05/_neon_channel_shuffle_workload_8cpp_source.xhtml b/23.05/_neon_channel_shuffle_workload_8cpp_source.xhtml new file mode 100644 index 0000000000..eb2be4ba56 --- /dev/null +++ b/23.05/_neon_channel_shuffle_workload_8cpp_source.xhtml @@ -0,0 +1,241 @@ + + + + + + + + + + + + + +ArmNN: src/backends/neon/workloads/NeonChannelShuffleWorkload.cpp Source File + + + + + + + + + + + + + + + + +
+
+ + + + ArmNN + + + +
+
+  23.05 +
+
+
+ + + + + + + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ +
+ +
+
+
NeonChannelShuffleWorkload.cpp
+
+
+Go to the documentation of this file.
1 //
+
2 // Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
+
3 // SPDX-License-Identifier: MIT
+
4 //
+
5 
+ +
7 #include "NeonWorkloadUtils.hpp"
+
8 
+ + +
11 
+ +
13 
+
14 namespace armnn
+
15 {
+
16 
+ +
18  const TensorInfo& output,
+
19  const ChannelShuffleDescriptor& descriptor)
+
20 {
+
21  arm_compute::TensorInfo aclInputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(input);
+
22  arm_compute::TensorInfo aclOutputInfo = armcomputetensorutils::BuildArmComputeTensorInfo(output);
+
23 
+
24  // In Arm NN and in NNAPI, channel shuffle implementation is datalayout agnostic and it has axis as a parameter.
+
25  // The channel shuffle Implementation for Neon is dependent on datalayout and does not have axis as a parameter,
+
26  // it only supports channel shuffle for 4D tensors in dimension C (1 or 3).
+
27  arm_compute::DataLayout aclDataLayout;
+
28  if (input.GetNumDimensions() == 4)
+
29  {
+
30  switch (descriptor.m_Axis)
+
31  {
+
32  case 1:
+
33  aclDataLayout = ConvertDataLayout(armnn::DataLayout::NCHW);
+
34  break;
+
35  case 3:
+
36  aclDataLayout = ConvertDataLayout(armnn::DataLayout::NHWC);
+
37  break;
+
38  default:
+
39  return arm_compute::Status{arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported axis"};
+
40  }
+
41  aclInputInfo.set_data_layout(aclDataLayout);
+
42  aclOutputInfo.set_data_layout(aclDataLayout);
+
43  return arm_compute::NEChannelShuffleLayer::validate(&aclInputInfo, &aclOutputInfo, descriptor.m_NumGroups);
+
44  }
+
45  else
+
46  {
+
47  return arm_compute::Status{arm_compute::ErrorCode::RUNTIME_ERROR, "Unsupported number of dimensions"};
+
48  }
+
49 }
+
50 
+ +
52  const WorkloadInfo& info)
+ +
54 {
+
55  // Report Profiling Details
+
56  ARMNN_REPORT_PROFILING_WORKLOAD_DESC("NeonChannelShufflenWorkload_Construct",
+
57  descriptor.m_Parameters,
+
58  info,
+
59  this->GetGuid());
+
60 
+
61  m_Data.ValidateInputsOutputs("NeonChannelShuffleWorkload", 1, 1);
+
62 
+
63  arm_compute::ITensor& input = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Inputs[0])->GetTensor();
+
64  arm_compute::ITensor& output = PolymorphicDowncast<IAclTensorHandle*>(m_Data.m_Outputs[0])->GetTensor();
+
65 
+
66  // In Arm NN and in NNAPI, channel shuffle implementation is datalayout agnostic and it has axis as a parameter.
+
67  // The channel shuffle Implementation for Neon is dependent on datalayout and does not have axis as a parameter,
+
68  // it only supports channel shuffle for 4D tensors in dimension C (1 or 3).
+
69  arm_compute::DataLayout aclDataLayout;
+
70  switch (descriptor.m_Parameters.m_Axis)
+
71  {
+
72  case 1:
+
73  aclDataLayout = ConvertDataLayout(armnn::DataLayout::NCHW);
+
74  break;
+
75  case 3:
+
76  aclDataLayout = ConvertDataLayout(armnn::DataLayout::NHWC);
+
77  break;
+
78  default:
+
79  ARMNN_ASSERT_MSG(false, "Unsupported axis");
+
80  break;
+
81  }
+
82  input.info()->set_data_layout(aclDataLayout);
+
83  output.info()->set_data_layout(aclDataLayout);
+
84 
+
85  m_ChannelShuffleLayer.configure(&input, &output, descriptor.m_Parameters.m_NumGroups);
+
86 }
+
87 
+ +
89 {
+
90  ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID("NeonChannelShuffleWorkload_Execute", this->GetGuid());
+
91  m_ChannelShuffleLayer.run();
+
92 }
+
93 
+
94 } // namespace armnn
+
+
+
arm::pipe::ProfilingGuid GetGuid() const final
Definition: Workload.hpp:61
+
void ValidateInputsOutputs(const std::string &descName, unsigned int numExpectedIn, unsigned int numExpectedOut) const
+
DataLayout
Definition: Types.hpp:62
+
uint32_t m_NumGroups
Number of groups for the channel shuffle operation.
+ + + +
NeonChannelShuffleWorkload(const ChannelShuffleQueueDescriptor &descriptor, const WorkloadInfo &info)
+
Copyright (c) 2021 ARM Limited and Contributors.
+ +
#define ARMNN_SCOPED_PROFILING_EVENT_NEON_GUID(name, guid)
+ + +
unsigned int GetNumDimensions() const
Definition: Tensor.hpp:195
+ +
uint32_t m_Axis
Axis to apply channel shuffle operation on.
+
A ChannelShuffleDescriptor for the ChannelShuffle operator.
+ + +
Status
Definition: Types.hpp:42
+ + +
#define ARMNN_ASSERT_MSG(COND, MSG)
Definition: Assert.hpp:15
+
Contains information about TensorInfos of a layer.
+
arm_compute::Status NeonChannelShuffleValidate(const TensorInfo &input, const TensorInfo &output, const ChannelShuffleDescriptor &descriptor)
+ +
#define ARMNN_REPORT_PROFILING_WORKLOAD_DESC(name, desc, infos, guid)
Definition: Profiling.hpp:227
+
std::vector< ITensorHandle * > m_Outputs
+ +
std::vector< ITensorHandle * > m_Inputs
+ + + + + -- cgit v1.2.1