ArmNN
 24.08
UtilsGpuFsa.hpp File Reference
#include "armnn/Descriptors.hpp"
#include "arm_compute/dynamic_fusion/sketch/attributes/Conv2dAttributes.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/DepthwiseConv2dAttributes.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/Pool2dAttributes.h"
#include "arm_compute/dynamic_fusion/sketch/attributes/ResizeAttributes.h"
Include dependency graph for UtilsGpuFsa.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

arm_compute::experimental::dynamic_fusion::Conv2dAttributes CreateConv2dAttributes (const armnn::Convolution2dDescriptor &descriptor)
 Utility function used to setup an arm_compute::Conv2dAttributes object from given descriptor. More...
 
arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes CreateDWConv2dAttributes (const armnn::DepthwiseConvolution2dDescriptor &descriptor, const unsigned int aclDepthMultiplier)
 Utility function used to setup an arm_compute::DepthwiseConv2dAttributes object from given descriptor. More...
 
arm_compute::experimental::dynamic_fusion::Pool2dAttributes CreatePool2dAttributes (const armnn::Pooling2dDescriptor &descriptor)
 Utility function used to setup an arm_compute::Pool2dAttributes object from given descriptor. More...
 
arm_compute::experimental::dynamic_fusion::ResizeAttributes CreateResizeAttributes (const armnn::ResizeDescriptor &descriptor)
 Utility function used to setup an arm_compute::ResizeDescriptor object from given descriptor. More...
 

Function Documentation

◆ CreateConv2dAttributes()

arm_compute::experimental::dynamic_fusion::Conv2dAttributes CreateConv2dAttributes ( const armnn::Convolution2dDescriptor descriptor)

Utility function used to setup an arm_compute::Conv2dAttributes object from given descriptor.

Parameters
[in]armnn::Convolution2dDescriptor
Returns
arm_compute::experimental::dynamic_fusion::Conv2dAttributes

Definition at line 14 of file UtilsGpuFsa.cpp.

15 {
16  const arm_compute::Padding2D padInfo = BuildArmComputePaddingInfo(descriptor);
17  const arm_compute::Size2D strideInfo = BuildArmComputeSize2D(descriptor.m_StrideX, descriptor.m_StrideY);
18  const arm_compute::Size2D dilationInfo = BuildArmComputeSize2D(descriptor.m_DilationX, descriptor.m_DilationY);
19 
20  arm_compute::experimental::dynamic_fusion::Conv2dAttributes conv2dAttributes{};
21  conv2dAttributes.pad(padInfo);
22  conv2dAttributes.stride(strideInfo);
23  conv2dAttributes.dilation(dilationInfo);
24 
25  return conv2dAttributes;
26 }

◆ CreateDWConv2dAttributes()

arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes CreateDWConv2dAttributes ( const armnn::DepthwiseConvolution2dDescriptor descriptor,
const unsigned int  aclDepthMultiplier 
)

Utility function used to setup an arm_compute::DepthwiseConv2dAttributes object from given descriptor.

Parameters
[in]armnn::DepthwiseConvolution2dDescriptor
Returns
arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes

Definition at line 29 of file UtilsGpuFsa.cpp.

30 {
31  const arm_compute::Padding2D padInfo = BuildArmComputePaddingInfo(descriptor);
32  const arm_compute::Size2D strideInfo = BuildArmComputeSize2D(descriptor.m_StrideX, descriptor.m_StrideY);
33  const arm_compute::Size2D dilationInfo = BuildArmComputeSize2D(descriptor.m_DilationX, descriptor.m_DilationY);
34 
35  arm_compute::experimental::dynamic_fusion::DepthwiseConv2dAttributes depthwiseConv2dAttributes{};
36  depthwiseConv2dAttributes.pad(padInfo);
37  depthwiseConv2dAttributes.stride(strideInfo);
38  depthwiseConv2dAttributes.dilation(dilationInfo);
39  depthwiseConv2dAttributes.depth_multiplier(aclDepthMultiplier);
40 
41  return depthwiseConv2dAttributes;
42 }

◆ CreatePool2dAttributes()

arm_compute::experimental::dynamic_fusion::Pool2dAttributes CreatePool2dAttributes ( const armnn::Pooling2dDescriptor descriptor)

Utility function used to setup an arm_compute::Pool2dAttributes object from given descriptor.

Parameters
[in]armnn::Pooling2dDescriptor
Returns
arm_compute::experimental::dynamic_fusion::Pool2dAttributes

Definition at line 45 of file UtilsGpuFsa.cpp.

46 {
47  const arm_compute::PoolingType poolType = ConvertPoolingAlgorithmToAclPoolingType(descriptor.m_PoolType);
48  const arm_compute::Padding2D padding = BuildArmComputePaddingInfo(descriptor);
49  const arm_compute::Size2D poolSize = BuildArmComputeSize2D(descriptor.m_PoolWidth, descriptor.m_PoolHeight);
50  const arm_compute::Size2D strides = BuildArmComputeSize2D(descriptor.m_StrideX, descriptor.m_StrideY);
51  const bool excludePadding = (descriptor.m_PaddingMethod == PaddingMethod::Exclude);
52 
53  arm_compute::experimental::dynamic_fusion::Pool2dAttributes pool2dAttributes{};
54  pool2dAttributes.pool_type(poolType);
55  pool2dAttributes.pad(padding);
56  pool2dAttributes.pool_size(poolSize);
57  pool2dAttributes.stride(strides);
58  pool2dAttributes.exclude_padding(excludePadding);
59 
60  return pool2dAttributes;
61 }

References armnn::ConvertPoolingAlgorithmToAclPoolingType(), and Pooling2dDescriptor::m_PoolType.

◆ CreateResizeAttributes()

arm_compute::experimental::dynamic_fusion::ResizeAttributes CreateResizeAttributes ( const armnn::ResizeDescriptor descriptor)

Utility function used to setup an arm_compute::ResizeDescriptor object from given descriptor.

Parameters
[in]armnn::ResizeDescriptor
Returns
arm_compute::experimental::dynamic_fusion::ResizeAttributes

Definition at line 64 of file UtilsGpuFsa.cpp.

65 {
66  arm_compute::experimental::dynamic_fusion::ResizeAttributes resizeAttributes{};
67  resizeAttributes.output_width(static_cast<int32_t>(descriptor.m_TargetWidth));
68  resizeAttributes.output_height(static_cast<int32_t>(descriptor.m_TargetHeight));
69  resizeAttributes.interpolation_policy(descriptor.m_Method == ResizeMethod::Bilinear ?
70  arm_compute::InterpolationPolicy::BILINEAR :
71  arm_compute::InterpolationPolicy::NEAREST_NEIGHBOR);
72  resizeAttributes.sampling_policy(descriptor.m_HalfPixelCenters ? arm_compute::SamplingPolicy::CENTER
73  : arm_compute::SamplingPolicy::TOP_LEFT);
74  resizeAttributes.align_corners(descriptor.m_AlignCorners);
75 
76  return resizeAttributes;
77 }

References armnn::Bilinear, ResizeDescriptor::m_AlignCorners, ResizeDescriptor::m_HalfPixelCenters, ResizeDescriptor::m_Method, ResizeDescriptor::m_TargetHeight, and ResizeDescriptor::m_TargetWidth.

armnn::Pooling2dDescriptor::m_PaddingMethod
PaddingMethod m_PaddingMethod
The padding method to be used. (Exclude, IgnoreValue).
Definition: Descriptors.hpp:425
armnn::ResizeDescriptor::m_HalfPixelCenters
bool m_HalfPixelCenters
Half Pixel Centers.
Definition: Descriptors.hpp:1018
armnn::ResizeDescriptor::m_TargetHeight
uint32_t m_TargetHeight
Target height value.
Definition: Descriptors.hpp:1009
armnn::Pooling2dDescriptor::m_PoolHeight
uint32_t m_PoolHeight
Pooling height value.
Definition: Descriptors.hpp:417
armnn::Pooling2dDescriptor::m_StrideY
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
Definition: Descriptors.hpp:421
armnn::Convolution2dDescriptor::m_StrideY
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
Definition: Descriptors.hpp:576
armnn::Pooling2dDescriptor::m_PoolWidth
uint32_t m_PoolWidth
Pooling width value.
Definition: Descriptors.hpp:415
armnn::DepthwiseConvolution2dDescriptor::m_StrideY
uint32_t m_StrideY
Stride value when proceeding through input for the height dimension.
Definition: Descriptors.hpp:702
armnn::Convolution2dDescriptor::m_DilationY
uint32_t m_DilationY
Dilation along y axis.
Definition: Descriptors.hpp:580
armnn::ResizeDescriptor::m_Method
ResizeMethod m_Method
The Interpolation method to use (Bilinear, NearestNeighbor).
Definition: Descriptors.hpp:1012
armnn::DepthwiseConvolution2dDescriptor::m_DilationY
uint32_t m_DilationY
Dilation factor value for height dimension.
Definition: Descriptors.hpp:706
armnn::Convolution2dDescriptor::m_StrideX
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
Definition: Descriptors.hpp:574
armnn::Pooling2dDescriptor::m_StrideX
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
Definition: Descriptors.hpp:419
armnn::ResizeDescriptor::m_TargetWidth
uint32_t m_TargetWidth
Target width value.
Definition: Descriptors.hpp:1007
armnn::ResizeDescriptor::m_AlignCorners
bool m_AlignCorners
Aligned corners.
Definition: Descriptors.hpp:1016
armnn::Convolution2dDescriptor::m_DilationX
uint32_t m_DilationX
Dilation along x axis.
Definition: Descriptors.hpp:578
armnn::DepthwiseConvolution2dDescriptor::m_DilationX
uint32_t m_DilationX
Dilation factor value for width dimension.
Definition: Descriptors.hpp:704
armnn::Pooling2dDescriptor::m_PoolType
PoolingAlgorithm m_PoolType
The pooling algorithm to use (Max. Average, L2).
Definition: Descriptors.hpp:405
armnn::ConvertPoolingAlgorithmToAclPoolingType
arm_compute::PoolingType ConvertPoolingAlgorithmToAclPoolingType(PoolingAlgorithm poolingAlgorithm)
Definition: ArmComputeUtils.hpp:155
armnn::DepthwiseConvolution2dDescriptor::m_StrideX
uint32_t m_StrideX
Stride value when proceeding through input for the width dimension.
Definition: Descriptors.hpp:700