Compute Library
 22.08
PadStrideInfo Class Reference

Padding and stride information class. More...

#include <Types.h>

Public Member Functions

 PadStrideInfo (unsigned int stride_x=1, unsigned int stride_y=1, unsigned int pad_x=0, unsigned int pad_y=0, DimensionRoundingType round=DimensionRoundingType::FLOOR)
 Constructor. More...
 
 PadStrideInfo (unsigned int stride_x, unsigned int stride_y, unsigned int pad_left, unsigned int pad_right, unsigned int pad_top, unsigned int pad_bottom, DimensionRoundingType round)
 Constructor. More...
 
std::pair< unsigned int, unsigned int > stride () const
 Get the stride. More...
 
bool padding_is_symmetric () const
 Check whether the padding is symmetric. More...
 
std::pair< unsigned int, unsigned int > pad () const
 Get the padding. More...
 
unsigned int pad_left () const
 Get the left padding. More...
 
unsigned int pad_right () const
 Get the right padding. More...
 
unsigned int pad_top () const
 Get the top padding. More...
 
unsigned int pad_bottom () const
 Get the bottom padding. More...
 
DimensionRoundingType round () const
 Get the rounding type. More...
 
bool has_padding () const
 Check whether this has any padding. More...
 

Detailed Description

Padding and stride information class.

Definition at line 669 of file Types.h.

Constructor & Destructor Documentation

◆ PadStrideInfo() [1/2]

PadStrideInfo ( unsigned int  stride_x = 1,
unsigned int  stride_y = 1,
unsigned int  pad_x = 0,
unsigned int  pad_y = 0,
DimensionRoundingType  round = DimensionRoundingType::FLOOR 
)
inline

Constructor.

Parameters
[in]stride_x(Optional) Stride, in elements, across x. Defaults to 1.
[in]stride_y(Optional) Stride, in elements, across y. Defaults to 1.
[in]pad_x(Optional) Padding, in elements, across x. Defaults to 0.
[in]pad_y(Optional) Padding, in elements, across y. Defaults to 0.
[in]round(Optional) Dimensions rounding. Defaults to FLOOR.

Definition at line 680 of file Types.h.

683  : _stride(std::make_pair(stride_x, stride_y)),
684  _pad_left(pad_x),
685  _pad_top(pad_y),
686  _pad_right(pad_x),
687  _pad_bottom(pad_y),
688  _round_type(round)
689  {
690  }
DimensionRoundingType round() const
Get the rounding type.
Definition: Types.h:764

◆ PadStrideInfo() [2/2]

PadStrideInfo ( unsigned int  stride_x,
unsigned int  stride_y,
unsigned int  pad_left,
unsigned int  pad_right,
unsigned int  pad_top,
unsigned int  pad_bottom,
DimensionRoundingType  round 
)
inline

Constructor.

Parameters
[in]stride_xStride, in elements, across x.
[in]stride_yStride, in elements, across y.
[in]pad_leftPadding across x on the left, in elements.
[in]pad_rightPadding across x on the right, in elements.
[in]pad_topPadding across y on the top, in elements.
[in]pad_bottomPadding across y on the bottom, in elements.
[in]roundDimensions rounding.

Definition at line 701 of file Types.h.

705  : _stride(std::make_pair(stride_x, stride_y)),
706  _pad_left(pad_left),
707  _pad_top(pad_top),
708  _pad_right(pad_right),
709  _pad_bottom(pad_bottom),
710  _round_type(round)
711  {
712  }
DimensionRoundingType round() const
Get the rounding type.
Definition: Types.h:764
unsigned int pad_top() const
Get the top padding.
Definition: Types.h:753
unsigned int pad_right() const
Get the right padding.
Definition: Types.h:748
unsigned int pad_bottom() const
Get the bottom padding.
Definition: Types.h:758
unsigned int pad_left() const
Get the left padding.
Definition: Types.h:743

Member Function Documentation

◆ has_padding()

bool has_padding ( ) const
inline

Check whether this has any padding.

Definition at line 770 of file Types.h.

Referenced by CpuIm2ColKernel::configure(), and CpuPool2dAssemblyWrapperKernel::validate().

771  {
772  return (_pad_left != 0 || _pad_top != 0 || _pad_right != 0 || _pad_bottom != 0);
773  }

◆ pad()

std::pair<unsigned int, unsigned int> pad ( ) const
inline

Get the padding.

Note
This should only be used when the padding is symmetric.
Returns
a pair: padding left/right, padding top/bottom

Definition at line 735 of file Types.h.

References ARM_COMPUTE_ERROR_ON.

Referenced by arm_compute::test::validation::reference::im2col_nchw(), and arm_compute::test::validation::reference::im2col_nhwc().

736  {
737  //this accessor should be used only when padding is symmetric
739  return std::make_pair(_pad_left, _pad_top);
740  }
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Definition: Error.h:466
bool padding_is_symmetric() const
Check whether the padding is symmetric.
Definition: Types.h:725

◆ pad_bottom()

◆ pad_left()

unsigned int pad_left ( ) const
inline

Get the left padding.

Definition at line 743 of file Types.h.

Referenced by arm_compute::misc::shape_calculator::compute_unpool_shape(), arm_compute::compute_winograd_convolution_tiles(), ClPool2dKernel::configure(), ClDirectConv2dKernel::configure(), NEFFTConvolutionLayer::configure(), CLFFTConvolutionLayer::configure(), CLGEMMDeconvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), arm_compute::test::validation::reference::conv2d_dft(), arm_compute::test::validation::reference::convolution_layer_nchw(), arm_compute::cpu::kernels::convolve_nchw(), arm_compute::cpu::kernels::convolve_nhwc(), arm_compute::test::validation::reference::deconvolution_layer(), arm_compute::deconvolution_output_dimensions(), arm_compute::graph::detail::fuse_pad_with_convolution(), CpuConv2d::get_convolution_method(), ClConv2d::get_convolution_method(), CpuPool2dAssemblyWrapperKernel::is_configured(), arm_compute::assembly_utils::map_to_arm_conv_padding(), arm_compute::operator<<(), arm_compute::test::validation::reference::pooling_layer_internal(), arm_compute::cpu::poolingMxN_fp32_neon_nhwc(), arm_compute::cpu::poolingMxN_q8_neon_nhwc(), CPPUpsampleKernel::run(), CLDeconvolutionLayerUpsampleKernel::run(), arm_compute::scaled_dimensions(), arm_compute::scaled_dimensions_signed(), Conv2dContent::select_conv_method(), CLDepthwiseConvolutionLayer::validate(), NEFFTConvolutionLayer::validate(), CLFFTConvolutionLayer::validate(), and CLGEMMDeconvolutionLayer::validate().

744  {
745  return _pad_left;
746  }

◆ pad_right()

◆ pad_top()

unsigned int pad_top ( ) const
inline

Get the top padding.

Definition at line 753 of file Types.h.

Referenced by arm_compute::misc::shape_calculator::compute_unpool_shape(), arm_compute::compute_winograd_convolution_tiles(), ClPool2dKernel::configure(), ClDirectConv2dKernel::configure(), NEFFTConvolutionLayer::configure(), CLFFTConvolutionLayer::configure(), CLGEMMDeconvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), arm_compute::test::validation::reference::conv2d_dft(), arm_compute::test::validation::reference::convolution_layer_nchw(), arm_compute::cpu::kernels::convolve_nchw(), arm_compute::cpu::kernels::convolve_nhwc(), arm_compute::test::validation::reference::deconvolution_layer(), arm_compute::deconvolution_output_dimensions(), arm_compute::graph::detail::fuse_pad_with_convolution(), CpuConv2d::get_convolution_method(), ClConv2d::get_convolution_method(), CpuPool2dAssemblyWrapperKernel::is_configured(), arm_compute::assembly_utils::map_to_arm_conv_padding(), arm_compute::operator<<(), arm_compute::test::validation::reference::pooling_layer_internal(), arm_compute::cpu::poolingMxN_fp32_neon_nhwc(), arm_compute::cpu::poolingMxN_q8_neon_nhwc(), CPPUpsampleKernel::run(), CLDeconvolutionLayerUpsampleKernel::run(), arm_compute::scaled_dimensions(), arm_compute::scaled_dimensions_signed(), Conv2dContent::select_conv_method(), CLDepthwiseConvolutionLayer::validate(), NEFFTConvolutionLayer::validate(), CLFFTConvolutionLayer::validate(), and CLGEMMDeconvolutionLayer::validate().

754  {
755  return _pad_top;
756  }

◆ padding_is_symmetric()

bool padding_is_symmetric ( ) const
inline

Check whether the padding is symmetric.

Returns
True if the padding is symmetric.

Definition at line 725 of file Types.h.

726  {
727  return (_pad_left == _pad_right) && (_pad_top == _pad_bottom);
728  }

◆ round()

DimensionRoundingType round ( ) const
inline

Get the rounding type.

Definition at line 764 of file Types.h.

Referenced by arm_compute::graph::detail::fuse_pad_with_convolution(), arm_compute::scaled_dimensions(), and arm_compute::scaled_dimensions_signed().

765  {
766  return _round_type;
767  }

◆ stride()

std::pair<unsigned int, unsigned int> stride ( ) const
inline

Get the stride.

Returns
a pair: stride x, stride y.

Definition at line 717 of file Types.h.

Referenced by arm_compute::calculate_same_pad(), arm_compute::misc::shape_calculator::compute_unpool_shape(), ClPool2dKernel::configure(), CpuPool2dKernel::configure(), ClDirectConv2dKernel::configure(), ClGemmConv2d::configure(), CpuGemmConv2d::configure(), NEDeconvolutionLayer::configure(), CLDirectDeconvolutionLayer::configure(), arm_compute::test::validation::reference::convolution_layer_nchw(), arm_compute::cpu::kernels::convolve_nchw(), arm_compute::cpu::kernels::convolve_nhwc(), arm_compute::test::validation::reference::deconvolution_layer(), arm_compute::deconvolution_output_dimensions(), arm_compute::graph::detail::fuse_pad_with_convolution(), CpuConv2d::get_convolution_method(), ClConv2d::get_convolution_method(), CLDeconvolutionLayer::get_deconvolution_method(), arm_compute::test::validation::reference::im2col_nchw(), arm_compute::test::validation::reference::im2col_nhwc(), CpuPool2dAssemblyWrapperKernel::is_configured(), arm_compute::operator<<(), arm_compute::test::validation::reference::pooling_layer_internal(), arm_compute::cpu::poolingMxN_fp32_neon_nhwc(), arm_compute::cpu::poolingMxN_q8_neon_nhwc(), CPPUpsampleKernel::run(), CLDeconvolutionLayerUpsampleKernel::run(), arm_compute::scaled_dimensions(), arm_compute::scaled_dimensions_signed(), Conv2dContent::select_conv_method(), ClGemmConv2d::validate(), NEFFTConvolutionLayer::validate(), NEDeconvolutionLayer::validate(), CLFFTConvolutionLayer::validate(), CLGEMMDeconvolutionLayer::validate(), and CLDirectDeconvolutionLayer::validate().

718  {
719  return _stride;
720  }

The documentation for this class was generated from the following file: