24.02.1
|
Go to the documentation of this file.
24 #ifndef ACL_ARM_COMPUTE_CORE_UTILS_MISC_SHAPECALCULATOR_H
25 #define ACL_ARM_COMPUTE_CORE_UTILS_MISC_SHAPECALCULATOR_H
41 namespace shape_calculator
55 const int input_dims =
input->num_dimensions();
66 #pragma GCC diagnostic push
67 #pragma GCC diagnostic ignored "-Warray-bounds"
68 std::sort(axis_local.
begin(), axis_local.
begin() + reduction_ops);
69 #pragma GCC diagnostic pop
71 for (
int i = 0; i < reduction_ops; ++i)
79 for (
int i = 0; i < reduction_ops; ++i)
81 out_shape.
set(axis_local[i], 1);
141 "The width of the input tensor must be a multiple of stride");
143 "The height of the input tensor must be a multiple of stride");
175 const size_t tmp_dim = weights_reshaped[0];
176 weights_reshaped.set(0, weights_reshaped[1]);
177 weights_reshaped.set(1, tmp_dim + (
has_bias ? 1 : 0));
183 return weights_reshaped;
196 bool reinterpret_input_as_3d =
false)
203 const unsigned int input_width = a.
dimension(0);
207 const unsigned int num_horiz_blocks = std::ceil(input_width /
static_cast<float>(lhs_info.
k0));
208 const unsigned int num_vert_blocks = std::ceil(input_height /
static_cast<float>(lhs_info.
m0));
211 const unsigned int block_size = lhs_info.
m0 * lhs_info.
k0;
214 const unsigned int output_width = block_size * num_horiz_blocks * lhs_info.
v0;
215 const unsigned int output_height = std::ceil(num_vert_blocks /
static_cast<float>(lhs_info.
v0));
218 lhs_shape.
set(0, output_width);
219 lhs_shape.
set(1, output_height);
221 if ((reinterpret_input_as_3d) && (lhs_shape.num_dimensions() > 2))
247 const unsigned int input_width = a.
dimension(0);
248 const unsigned int input_height = a.
dimension(1);
251 const unsigned int num_horiz_blocks = std::ceil(input_width /
static_cast<float>(rhs_info.
n0));
252 const unsigned int num_vert_blocks = std::ceil(input_height /
static_cast<float>(rhs_info.
k0));
255 const unsigned int block_size = rhs_info.
n0 * rhs_info.
k0;
258 const unsigned int output_width = block_size * num_vert_blocks * rhs_info.
h0;
259 const unsigned int output_height = std::ceil(num_horiz_blocks /
static_cast<float>(rhs_info.
h0));
262 rhs_shape.
set(0, output_width);
263 rhs_shape.
set(1, output_height);
281 const int interleave_width = 4 * mult_interleave4x4_height;
283 shape_interleaved_a.
set(0, a.
dimension(0) * interleave_width);
284 if (reinterpret_input_as_3d)
287 const int height = std::ceil(
M /
static_cast<float>(interleave_width));
288 shape_interleaved_a.set(1, height);
294 if (shape_interleaved_a.num_dimensions() > 2)
296 shape_interleaved_a.remove_dimension(2);
301 shape_interleaved_a.set(1, std::ceil(a.
dimension(1) /
static_cast<float>(interleave_width)));
304 return shape_interleaved_a;
317 shape_transposed1xW_b.set(0,
b.dimension(1) * 16);
318 shape_transposed1xW_b.set(1, std::ceil(
b.dimension(0) / 16.f));
320 return shape_transposed1xW_b;
337 const size_t transpose_width = (16 /
b.element_size()) * mult_transpose1xW_width;
338 shape_transposed1xW_b.set(0,
b.dimension(1) * transpose_width);
339 shape_transposed1xW_b.set(1,
static_cast<size_t>(std::ceil(
b.dimension(0) /
static_cast<float>(transpose_width))));
341 return shape_transposed1xW_b;
353 if (shape_vector_sum_col.num_dimensions() > 1)
355 shape_vector_sum_col.remove_dimension(1);
358 return shape_vector_sum_col;
371 if (shape_vector_sum_row.num_dimensions() > 1)
376 return shape_vector_sum_row;
389 const Size2D &convolved_dims,
390 bool batch_size_on_z,
407 col2im_shape.shift_right(1);
426 shape_transposed.set(0,
input.dimension(1),
false);
427 shape_transposed.set(1,
input.dimension(0),
false);
429 return shape_transposed;
455 unsigned int output_width = 0;
456 unsigned int output_height = 0;
457 std::tie(output_width, output_height) =
459 weights_shape[weights_height_idx],
info.pad_stride_info,
info.dilation);
483 std::pair<uint32_t, uint32_t> out_dims)
490 int32_t out_x = (
static_cast<int32_t
>(
input.dimension(idx_w)) - 1) * sx + 1;
491 int32_t out_y = (
static_cast<int32_t
>(
input.dimension(idx_h)) - 1) * sy + 1;
494 int32_t padx = out_dims.first - (out_x -
static_cast<int32_t
>(weights.
dimension(idx_w)) + 1);
495 int32_t pady = out_dims.second - (out_y -
static_cast<int32_t
>(weights.
dimension(idx_h)) + 1);
497 return std::make_pair(padx, pady);
516 std::pair<unsigned int, unsigned int> &out_dims,
523 padx =
static_cast<uint32_t
>(padxy.first);
524 pady =
static_cast<uint32_t
>(padxy.second);
531 uint32_t out_x = (
input.dimension(idx_w) - 1) * sx + 1;
532 uint32_t out_y = (
input.dimension(idx_h) - 1) * sy + 1;
538 scale_out_shape.
set(idx_w, out_x);
539 scale_out_shape.
set(idx_h, out_y);
541 return scale_out_shape;
586 const Size2D &kernel_dims,
590 bool batch_size_on_z,
592 unsigned int input_pad_right = 0)
657 if (axis < input->num_dimensions())
694 const Size2D input_tile_size =
718 const Size2D input_tile_size =
729 const unsigned int width =
input.tensor_shape()[idx_c];
730 const unsigned int height = num_tiles.
area();
731 const unsigned int depth = input_tile_size.
area();
756 unsigned int output_width = 0;
757 unsigned int output_height = 0;
764 const unsigned int out_w = output_width;
765 const unsigned int out_h = output_height;
766 const unsigned int out_c =
input.dimension(0);
795 const unsigned int weights_width = weights_shape[
idx_width];
796 const unsigned int weights_height = weights_shape[
idx_height];
797 const unsigned int weights_out_channel = weights_shape[3];
798 unsigned int output_width = 0;
799 unsigned int output_height = 0;
800 std::tie(output_width, output_height) =
844 const unsigned int m0 = desc.
m0;
845 const unsigned int kw = weights_shape[1];
846 const unsigned int kh = weights_shape[2];
851 const unsigned int output_w = m0 * kw * kh;
852 const unsigned int output_h =
DIV_CEIL(output_conv2d_shape[1] * output_conv2d_shape[2], m0);
853 const unsigned int output_b = output_conv2d_shape[3];
896 std::tie(pooled_w, pooled_h) =
921 const unsigned int stride_x = pad_stride_info.
stride().first;
922 const unsigned int stride_y = pad_stride_info.
stride().second;
924 const int pad_left = pad_stride_info.
pad_left();
925 const int pad_top = pad_stride_info.
pad_top();
926 const int pad_right = pad_stride_info.
pad_right();
927 const int pad_bottom = pad_stride_info.
pad_bottom();
930 const unsigned int out_width =
932 const unsigned int out_height =
989 bool is_interleaved_transposed,
995 "The first input tensor cannot be reinterpreted as 3D if is_interleaved_transposed is true");
999 const int depth_output_gemm3d = reinterpret_output_as_3d ? reshape_info.
depth_output_gemm3d() : 1;
1005 const int dim0 = is_interleaved_transposed ? reshape_info.
n() : input1.
dimension(0);
1006 const int dim1 = is_interleaved_transposed ? reshape_info.
m() / depth_output_gemm3d : m / depth_output_gemm3d;
1008 const int dim3 = reinterpret_input_as_3d ? 1 : input0.
tensor_shape()[3];
1014 output_shape.
set(2, reinterpret_output_as_3d ? depth_output_gemm3d : dim2);
1037 const int depth_output_gemm3d = reinterpret_output_as_3d ? gemm_info.
depth_output_gemm3d() : 1;
1041 if (!reinterpret_input_as_3d && !reinterpret_output_as_3d)
1053 output_shape.
set(2, reinterpret_output_as_3d ? depth_output_gemm3d : batch_size);
1076 const unsigned int depth_output_gemm3d = reinterpret_output_as_3d ? gemm_info.
depth_output_gemm3d : 1;
1080 if (!reinterpret_input_as_3d && !reinterpret_output_as_3d)
1092 output_shape.
set(2, reinterpret_output_as_3d ? depth_output_gemm3d : batch_size);
1142 if (gemm_3d_depth > 1)
1144 if (batch_size_on_z)
1174 int32_t shrink_axis_mask)
1219 unsigned int new_width =
input[
idx_width] *
static_cast<unsigned int>(block_x);
1220 unsigned int new_height =
input[
idx_height] *
static_cast<unsigned int>(block_y);
1221 const unsigned int width_crop = crop_info.left + crop_info.right;
1222 const unsigned int height_crop = crop_info.top + crop_info.bottom;
1225 new_width -= width_crop;
1226 new_height -= height_crop;
1270 empty_shape.
set(0, 0);
1275 if (axis >
input->tensor_shape().num_dimensions())
1280 size_t axis_size = out_shape[axis];
1283 if (axis_size % num_splits)
1288 out_shape[axis] = axis_size / num_splits;
1357 const int num_priors =
info.aspect_ratios().size() *
info.min_sizes().size() +
info.max_sizes().size();
1376 for (
size_t dim = 0; dim < padding.size(); ++dim)
1378 const auto &padding_pair = padding[dim];
1380 padded_shape.
set(dim, padding_pair.first + shape_on_index + padding_pair.second);
1382 return padded_shape;
1395 for (
size_t dim = 0; dim < multiples.size(); ++dim)
1445 return scale_out_shape;
1454 template <
typename T>
1457 return data->info()->tensor_shape();
1500 template <
typename T>
1505 #if defined(ARM_COMPUTE_ASSERTS_ENABLED)
1507 for (
unsigned int i = 0; i <
MAX_DIMS; ++i)
1521 #endif // defined(ARM_COMPUTE_ASSERTS_ENABLED)
1524 size_t new_size = 0;
1528 new_size +=
shape[axis];
1531 out_shape.
set(axis, new_size);
1549 shape_out.
set(axis, num_tensors);
1551 unsigned int i_shift = 0;
1592 const size_t pad_top = conv3d_info.
padding.
top;
1599 const size_t stride_x = conv3d_info.
stride.
x();
1600 const size_t stride_y = conv3d_info.
stride.
y();
1601 const size_t stride_z = conv3d_info.
stride.
z();
1603 int output_width_size = 0;
1604 int output_height_size = 0;
1605 int output_depth_size = 0;
1611 static_cast<int>(std::floor((
static_cast<float>(
src[
width_dim] + pad_left + pad_right -
1615 output_height_size =
1616 static_cast<int>(std::floor((
static_cast<float>(
src[
height_dim] + pad_top + pad_bottom -
1621 static_cast<int>(std::floor((
static_cast<float>(
src[
depth_dim] + pad_front + pad_back -
1628 static_cast<int>(std::ceil((
static_cast<float>(
src[
width_dim] + pad_left + pad_right -
1632 output_height_size =
1633 static_cast<int>(std::ceil((
static_cast<float>(
src[
height_dim] + pad_top + pad_bottom -
1638 static_cast<int>(std::ceil((
static_cast<float>(
src[
depth_dim] + pad_front + pad_back -
1673 int output_width = 0;
1674 int output_height = 0;
1675 int output_depth = 0;
1677 std::tie(output_width, output_height, output_depth) =
1679 pool_size_depth, pool3d_info);
1682 "Calculated output dimension size is invalid");
1715 for (; dim_no < actual_axis; ++dim_no)
1720 for (; dim_no < actual_axis + indices_num_dims; ++dim_no)
1725 for (; dim_no < input_num_dims + indices_num_dims - 1; ++dim_no)
1738 #endif // ACL_ARM_COMPUTE_CORE_UTILS_MISC_SHAPECALCULATOR_H
@ NCHW
Num samples, channels, height, width.
TensorShape compute_pool3d_shape(const TensorShape &src, Pooling3dLayerInfo pool3d_info)
Calculate the output pool3d shape of a tensor.
TensorShape calculate_unstack_shape(TensorShape input_shape, unsigned int axis)
Calculate the unstack shape of a tensor.
TensorShape compute_winograd_input_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd input transform shape.
bool reinterpret_input_as_3d
Flag used to reinterpret the input as 3D.
unsigned int m
Number of LHS rows.
size_t y() const
Semantic accessor for height as y.
TensorShape compute_transpose1xW_shape(const ITensorInfo &b)
Calculate the transposed 1xW shape.
TensorShape compute_stack_shape(const ITensorInfo &a, unsigned int axis, unsigned int num_tensors)
Calculate the stack output shape of a tensor.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
TensorShape compute_matmul_shape(const TensorShape &input0, const TensorShape &input1, const MatMulKernelInfo &matmul_info)
Calculate the matrix multiplication output shape of two tensors.
constexpr unsigned int weights_CHout_dim
SimpleTensor< float > src
DataLayout output_data_layout
Data layout to use for the output tensor once the convolution has been applied (NCHW or NHWC)
std::pair< int32_t, int32_t > compute_deconvolution_padding(const ITensorInfo &input, const ITensorInfo &weights, int32_t sx, int32_t sy, std::pair< uint32_t, uint32_t > out_dims)
Calculate padding required for deconvolution.
TensorShape compute_strided_slice_shape(const ITensorInfo &input, const Coordinates &starts, const Coordinates &ends, const Coordinates &strides, int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask)
Calculate the strided slice output shape of a tensor.
Coordinates BiStrides
Bidirectional strides.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
TensorShape compute_depth_to_space_shape(const TensorShape &input_shape, DataLayout data_layout, int block)
Calculate the depth to space output shape of a tensor.
unsigned int pooled_width() const
Get the pooled width of the layer.
std::vector< PaddingInfo > PaddingList
List of padding information.
unsigned int n0
Number of columns processed by the matrix multiplication.
DataLayout
[DataLayout enum definition]
unsigned int pad_right() const
Get the right padding.
TensorShape compute_mm_shape(const ITensorInfo &input0, const ITensorInfo &input1, bool is_interleaved_transposed, const GEMMReshapeInfo &reshape_info)
Calculate the matrix multiplication output shape of two tensors.
TensorShape compute_depthwise_convolution_shape(const ITensorInfo &input, const ITensorInfo &weights, const ConvolutionInfo &info)
Calculate the depthwise convolution output shape of a tensor.
TensorShape compute_permutation_output_shape(const ITensorInfo &input, const PermutationVector &perm)
Calculate the permuted shape of an input given a permutation vector.
GEMM reshape information class.
@ NHWC
Num samples, height, width, channels.
Size2D compute_winograd_convolution_tiles(const Size2D &in_dims, const Size2D &kernel_size, const Size2D &output_tile_size, const PadStrideInfo &conv_info)
Calculate the number of output tiles required by Winograd Convolution layer.
TensorShape compute_pool_shape(const ITensorInfo &input, PoolingLayerInfo pool_info)
Calculate the output pool shape of a tensor.
int n() const
Number of matrix B columns.
Size2D output_tile_size
Width and height of the output tile.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
TensorShape compute_roi_align_shape(const ITensorInfo &input, const ITensorInfo &rois, ROIPoolingLayerInfo pool_info)
Calculate the output roi align shape of a tensor.
constexpr unsigned int weights_depth_dim
bool adj_rhs
Get Adjoint RHS flag value.
Size2D input_dimensions
Width and height of the input tensor before the convolution is applied.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
TensorShape compute_slice_shape(const TensorShape &input_shape, const Coordinates &starts, const Coordinates &ends)
Calculate the slice output shape of a tensor.
std::pair< unsigned int, unsigned int > scaled_dimensions(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info, const Size2D &dilation=Size2D(1U, 1U))
Returns expected width and height of output scaled tensor depending on dimensions rounding mode.
Class for specifying the size of an image or rectangle.
TensorShape calculate_concatenate_shape(const std::vector< T * > &input, size_t axis)
Calculate the concatenate output shape of the concatenate operation along a single axis.
TensorShape compute_lhs_reshaped_shape(const ITensorInfo &a, const GEMMLHSMatrixInfo &lhs_info, bool reinterpret_input_as_3d=false)
Calculate the Left Hand Side matrix reshaped shape.
void permute(Dimensions< T > &dimensions, const PermutationVector &perm)
Permutes given Dimensions according to a permutation vector.
size_t height
Height of the image region or rectangle.
TensorShape compute_indirect_buffer_shape(const TensorShape &input_shape, DataLayout input_data_layout, const TensorShape &weights_shape, const PadStrideInfo &conv_info, const DirectConvComputeKernelInfo &desc)
Calculate the indirect buffer output shape used by the indirect convolution function.
size_t x() const
Semantic accessor for width as x.
TensorShape compute_reductionA_shape(const ITensorInfo &b)
Calculate the reductionA shape used in GEMMLowp.
size_t width
Width of the 3D shape or object.
TensorShape compute_gather_shape(const TensorShape &input_shape, const TensorShape &indices_shape, uint32_t actual_axis)
Calculate the gather output shape of a tensor.
unsigned int v0
Number of vertical blocks of size (m0xk0) stored on the same output row.
unsigned int pooled_height() const
Get the pooled height of the layer.
TensorShape compute_transposed_shape(const ITensorInfo &input)
Calculate the transposed shape of a tensor.
Descriptor used by the GEMM kernels.
TensorShape calculate_reduce_mean_shape(ITensorInfo *input, const Coordinates &reduction_axis, bool keep_dims)
Calculate the output tensor shape for the reduce mean operation.
constexpr auto DIV_CEIL(S val, T m) -> decltype((val+m - 1)/m)
Calculate the rounded up quotient of val / m.
constexpr unsigned int weights_width_dim
TensorShape compute_min_max_shape(const ITensorInfo *input)
Calculate the min/max shape output shape of a tensor.
std::pair< int, int > scaled_dimensions_signed(int width, int height, int kernel_width, int kernel_height, const PadStrideInfo &pad_stride_info)
Returns calculated width and height of output scaled tensor depending on dimensions rounding mode.
size_t area() const
The area of the image or rectangle calculated as (width * height)
bool reinterpret_input_as_3d() const
Flag which specifies if the input tensor has to be reinterpreted as 3D.
constexpr auto data_layout
TensorShape compute_reorg_output_shape(const ITensorInfo &input, int32_t stride)
Calculate the output shape of the reorg layer given a stride.
int m() const
Number of matrix A rows.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
TensorShape compute_im2col_conv_shape(const ITensorInfo *input, const Size2D &kernel_dims, const PadStrideInfo &conv_info, bool has_bias, const Size2D &dilation, bool batch_size_on_z, unsigned int num_groups=1, unsigned int input_pad_right=0)
Calculate the im2col output shape of a tensor.
constexpr unsigned int height_dim
Strides of an item in bytes.
void shift_right(size_t step)
Shifts right the tensor shape increasing its dimensions.
TensorShape compute_transpose1xW_with_element_size_shape(const ITensorInfo &b, int mult_transpose1xW_width=1)
Calculate the transposed 1xW width element shape.
TensorShape compute_output_stage_shape(const ITensorInfo &input, unsigned int gemm_3d_depth=1, bool batch_size_on_z=false)
Calculate the matrix multiplication output shape of two tensors.
constexpr unsigned int depth_dim
size_t y() const
Semantic accessor for height as y.
size_t height
Height of the 3D shape or object.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
constexpr size_t MAX_DIMS
Constant value used to indicate maximum dimensions of a Window, TensorShape and Coordinates.
TensorShape compute_interleaved_shape(const ITensorInfo &a, int mult_interleave4x4_height=1, bool reinterpret_input_as_3d=false)
Calculate the interleaved shape of an input tensor.
TensorShape compute_rnn_shape(const ITensorInfo *input, const unsigned int batch_size)
Calculate the RNN shape of a tensor.
unsigned int n
Number of RHS columns.
TensorShape compute_deconvolution_output_shape(const std::pair< unsigned int, unsigned int > &out_dims, const ITensorInfo &input, const ITensorInfo &weights)
Calculate the output shape of the deconvolution layer.
size_t depth
Depth of the 3D shape or object.
size_t width
Width of the image region or rectangle.
size_t top
Padding across the height dimenstion on the top, in elements.
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
TensorShape compute_vector_to_tensor_output_shape(const TensorShape &input, size_t conv_w, size_t conv_h, const DataLayout &data_layout)
Calculate the output tensor shape of a vector input given the convolution dimensions.
unsigned int m0
Number of rows processed by the matrix multiplication.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
constexpr unsigned int width_dim
size_t total_size() const
Collapses all dimensions to a single linear total size.
TensorShape compute_softmax_shape(const ITensorInfo *input, size_t axis=1)
Calculate the softmax output shape of a tensor.
TensorShape compute_flatten_shape(const ITensorInfo *input)
Calculate the flattened output shape of a tensor.
Pooling Layer Information struct.
TensorShape compute_unpool_shape(const ITensorInfo &input, PoolingLayerInfo pool_info)
Calculate the output unpool shape of a tensor.
TensorShape compute_winograd_filter_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd filter transform shape.
TensorShape compute_tiled_shape(const TensorShape &input_shape, const Multiples &multiples)
Calculate the tiled shape of a tensor.
int32_t m0
Number of rows to be processed by the kernel.
size_t back
Padding across the depth dimenstion on the back, in elements.
size_t front
Padding across the depth dimenstion on the front, in elements.
TensorShape compute_winograd_output_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd output transform shape.
TensorShape compute_reduced_shape(const TensorShape &input, unsigned int axis, bool keep_dims=true)
Calculate the reduced shape of a tensor given an axis.
TensorShape compute_prior_box_shape(const ITensorInfo &input, const PriorBoxLayerInfo &info)
Calculate the prior box output shape of a tensor.
size_t x() const
Semantic accessor for width as x.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
void collapse_from(size_t start)
Collapse dimensions starting from a given point.
CLTensor * tensor
Pointer to the auxiliary tensor.
size_t z() const
Semantic accessor for depth as z.
TensorShape compute_space_to_batch_shape(const ITensorInfo *input, int block_x, int block_y, const Size2D &padding_left, const Size2D &padding_right)
Calculate the space to batch output shape of a tensor.
std::array< T, num_max_dimensions >::iterator begin()
Returns a read/write iterator that points to the first element in the dimension array.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
constexpr unsigned int channel_dim
TensorShape compute_reductionB_shape(const ITensorInfo &a)
Calculate the reductionB shape used in GEMMLowp.
constexpr unsigned int weights_height_dim
TensorShape compute_padded_shape(const TensorShape &input_shape, const PaddingList &padding)
Calculate the padded shape of a tensor.
TensorShape input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
Pooling Layer Information struct.
unsigned int pad_left() const
Get the left padding.
bool adj_lhs
Get Adjoint LHS flag value.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
TensorShape compute_rhs_reshaped_shape(const ITensorInfo &a, const GEMMRHSMatrixInfo &rhs_info)
Calculate the Right Hand Side matrix reshaped shape.
size_t left
Padding across the width dimenstion on the left, in elements.
GEMM LHS (Left Hand Side) matrix information.
TensorShape compute_upsample_shape(const ITensorInfo &input, const Size2D &info)
Calculate the upsampled shape of a tensor.
const unsigned int num_groups
TensorShape compute_weights_reshaped_shape(const ITensorInfo &weights, bool has_bias=false, unsigned int num_groups=1)
Calculate the reshaped shape of the weights.
TensorShape compute_conv3d_shape(const TensorShape &src, const TensorShape &weights, const Conv3dInfo &conv3d_info)
Calculate the output shape of 3d Convolution.
unsigned int pad_bottom() const
Get the bottom padding.
int depth_output_gemm3d() const
Depth (third dimension) of the output tensor to be used with the GEMM3D kernel.
Copyright (c) 2017-2024 Arm Limited.
TensorShape compute_batch_to_space_shape(DataLayout data_layout, const TensorShape &input, int block_x, int block_y, const CropInfo &crop_info=CropInfo{})
Calculate the batch to space output shape of a tensor.
std::tuple< int, int, int > scaled_3d_dimensions_signed(int width, int height, int depth, int kernel_width, int kernel_height, int kernel_depth, const Pooling3dLayerInfo &pool3d_info)
Returns calculated width, height and depth of output scaled tensor depending on dimensions rounding m...
void remove_dimension(size_t n, bool apply_dim_correction=true)
Accessor to remove the dimension n from the tensor shape.
TensorShape extract_shape(T *data)
Get the tensor shape.
Descriptor used by the 3d Convolution function.
std::vector< uint32_t > Multiples
Information to produce a tiled version of a Tensor.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
Size2D kernel_size
Width and height of the kernel.
TensorShape compute_deconvolution_upsampled_shape(const ITensorInfo &input, const ITensorInfo &weights, unsigned int sx, unsigned int sy, std::pair< unsigned int, unsigned int > &out_dims, uint32_t &padx, uint32_t &pady)
Calculate the upsampled output shape used for deconvolution.
size_t right
Padding across the width dimenstion on the right, in elements.
TensorShape compute_space_to_depth_shape(const ITensorInfo *input, int32_t block_shape)
Calculate the space to batch output shape of a tensor.
size_t bottom
Padding across the height dimenstion on the bottom, in elements.
Store the tensor's metadata.
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
Padding and stride information class.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
unsigned int depth_output_gemm3d
Depth of the output tensor in case is reinterpreted as 3D.
PadStrideInfo convolution_info
Convolution info (Pads, strides,...)
TensorShape & set(size_t dimension, size_t value, bool apply_dim_correction=true, bool increase_dim_unit=true)
Accessor to set the value of one of the dimensions.
Coordinates & convert_negative_axis(Coordinates &coords, int max_value)
Convert negative coordinates to positive in the range [0, num_dims_input].
TensorShape compute_split_shape(const ITensorInfo *input, unsigned int axis, unsigned int num_splits)
Calculate the split output shape of a tensor.
constexpr unsigned int batch_dim
TensorShape compute_deep_convolution_shape(const TensorShape &input_shape, DataLayout input_data_layout, const TensorShape &weights_shape, const PadStrideInfo &conv_info)
Calculate the deep convolution shape output shape of a tensor.
GEMM RHS (Right Hand Side) matrix information.
TensorShape compute_col2im_shape(const ITensorInfo &input, const Size2D &convolved_dims, bool batch_size_on_z, unsigned int num_groups=1)
Calculate the Col2Im shape.
PadStrideInfo pad_stride_info
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
unsigned int h0
Number of horizontal blocks of size (k0xn0) stored on the same output row.
ROI Pooling Layer Information class.
static constexpr size_t num_max_dimensions
Number of dimensions the tensor has.
unsigned int pad_top() const
Get the top padding.
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
@ NDHWC
Num samples, depth, height, width, channels.
DimensionRoundingType round_type
Compute descriptor used by the direct convolution kernel.
void collapse(size_t n, size_t first=0)
Collapse the first n dimensions.