23.08
|
Go to the documentation of this file.
24 #ifndef ACL_ARM_COMPUTE_CORE_UTILS_MISC_SHAPECALCULATOR
25 #define ACL_ARM_COMPUTE_CORE_UTILS_MISC_SHAPECALCULATOR
42 namespace shape_calculator
56 const int input_dims =
input->num_dimensions();
64 std::sort(axis_local.
begin(), axis_local.
begin() + reduction_ops);
65 for(
int i = 0; i < reduction_ops; ++i)
73 for(
int i = 0; i < reduction_ops; ++i)
75 out_shape.
set(axis_local[i], 1);
163 const size_t tmp_dim = weights_reshaped[0];
164 weights_reshaped.set(0, weights_reshaped[1]);
165 weights_reshaped.set(1, tmp_dim + (
has_bias ? 1 : 0));
171 return weights_reshaped;
193 const unsigned int num_horiz_blocks = std::ceil(
input_width /
static_cast<float>(
lhs_info.k0));
200 const unsigned int output_width = block_size * num_horiz_blocks *
lhs_info.v0;
201 const unsigned int output_height = std::ceil(num_vert_blocks /
static_cast<float>(
lhs_info.v0));
204 lhs_shape.
set(0, output_width);
205 lhs_shape.
set(1, output_height);
207 if((reinterpret_input_as_3d) && (lhs_shape.num_dimensions() > 2))
237 const unsigned int num_horiz_blocks = std::ceil(
input_width /
static_cast<float>(
rhs_info.n0));
244 const unsigned int output_width = block_size * num_vert_blocks *
rhs_info.h0;
245 const unsigned int output_height = std::ceil(num_horiz_blocks /
static_cast<float>(
rhs_info.h0));
248 rhs_shape.
set(0, output_width);
249 rhs_shape.
set(1, output_height);
266 const int interleave_width = 4 * mult_interleave4x4_height;
268 shape_interleaved_a.
set(0, a.
dimension(0) * interleave_width);
269 if(reinterpret_input_as_3d)
272 const int height = std::ceil(
M /
static_cast<float>(interleave_width));
273 shape_interleaved_a.set(1, height);
279 if(shape_interleaved_a.num_dimensions() > 2)
281 shape_interleaved_a.remove_dimension(2);
286 shape_interleaved_a.set(1, std::ceil(a.
dimension(1) /
static_cast<float>(interleave_width)));
289 return shape_interleaved_a;
302 shape_transposed1xW_b.set(0,
b.dimension(1) * 16);
303 shape_transposed1xW_b.set(1, std::ceil(
b.dimension(0) / 16.f));
305 return shape_transposed1xW_b;
322 const size_t transpose_width = (16 /
b.element_size()) * mult_transpose1xW_width;
323 shape_transposed1xW_b.set(0,
b.dimension(1) * transpose_width);
324 shape_transposed1xW_b.set(1,
static_cast<size_t>(std::ceil(
b.dimension(0) /
static_cast<float>(transpose_width))));
326 return shape_transposed1xW_b;
338 if(shape_vector_sum_col.num_dimensions() > 1)
340 shape_vector_sum_col.remove_dimension(1);
343 return shape_vector_sum_col;
356 if(shape_vector_sum_row.num_dimensions() > 1)
361 return shape_vector_sum_row;
389 col2im_shape.shift_right(1);
391 col2im_shape.set(width_idx, convolved_dims.
width);
392 col2im_shape.set(height_idx, convolved_dims.
height);
408 shape_transposed.set(0,
input.dimension(1),
false);
409 shape_transposed.set(1,
input.dimension(0),
false);
411 return shape_transposed;
436 unsigned int output_width = 0;
437 unsigned int output_height = 0;
440 info.pad_stride_info,
info.dilation);
463 std::pair<unsigned int, unsigned int> &out_dims, uint32_t &padx, uint32_t &pady)
470 unsigned int out_x = (
input.dimension(idx_w) - 1) * sx + 1;
471 unsigned int out_y = (
input.dimension(idx_h) - 1) * sy + 1;
474 padx = out_dims.first - (out_x - weights.
dimension(idx_w) + 1);
475 pady = out_dims.second - (out_y - weights.
dimension(idx_h) + 1);
480 scale_out_shape.
set(idx_w, out_x);
481 scale_out_shape.
set(idx_h, out_y);
483 return scale_out_shape;
506 out_shape.set(width_idx, out_dims.first);
507 out_shape.set(height_idx, out_dims.second);
526 unsigned int num_groups = 1,
unsigned int input_pad_right = 0)
544 output_shape.set(1, (out_dims.first * out_dims.second));
545 if(batch_size_on_z &&
output_shape.num_dimensions() >= 3)
589 if(axis < input->num_dimensions())
660 const unsigned int width =
input.tensor_shape()[idx_c];
661 const unsigned int height = num_tiles.
area();
662 const unsigned int depth = input_tile_size.
area();
687 unsigned int output_width = 0;
688 unsigned int output_height = 0;
695 const unsigned int out_w = output_width;
696 const unsigned int out_h = output_height;
697 const unsigned int out_c =
input.dimension(0);
726 unsigned int output_width = 0;
727 unsigned int output_height = 0;
767 const unsigned int m0 = desc.
m0;
773 const unsigned int output_w = m0 * kw * kh;
774 const unsigned int output_h =
DIV_CEIL(output_conv2d_shape[1] * output_conv2d_shape[2], m0);
775 const unsigned int output_b = output_conv2d_shape[3];
819 pool_size_x, pool_size_y,
844 const unsigned int stride_x = pad_stride_info.
stride().first;
845 const unsigned int stride_y = pad_stride_info.
stride().second;
847 const int pad_left = pad_stride_info.
pad_left();
848 const int pad_top = pad_stride_info.
pad_top();
849 const int pad_right = pad_stride_info.
pad_right();
850 const int pad_bottom = pad_stride_info.
pad_bottom();
914 const int depth_output_gemm3d = reinterpret_output_as_3d ? reshape_info.
depth_output_gemm3d() : 1;
919 const int dim0 = is_interleaved_transposed ? reshape_info.
n() : input1.
dimension(0);
920 const int dim1 = is_interleaved_transposed ? reshape_info.
m() / depth_output_gemm3d :
m / depth_output_gemm3d;
922 const int dim3 = reinterpret_input_as_3d ? 1 : input0.
tensor_shape()[3];
928 output_shape.set(2, reinterpret_output_as_3d ? depth_output_gemm3d : dim2);
929 output_shape.set(3, reinterpret_output_as_3d ? dim2 : dim3);
930 output_shape.set(4, reinterpret_output_as_3d ? dim3 : 1);
948 const bool reinterpret_input_as_3d =
gemm_info.reinterpret_input_as_3d();
949 const bool reinterpret_output_as_3d =
gemm_info.depth_output_gemm3d() != 0;
950 const int depth_output_gemm3d = reinterpret_output_as_3d ?
gemm_info.depth_output_gemm3d() : 1;
954 if(!reinterpret_input_as_3d && !reinterpret_output_as_3d)
966 output_shape.set(2, reinterpret_output_as_3d ? depth_output_gemm3d : batch_size);
967 output_shape.set(3, reinterpret_output_as_3d ? batch_size : 1);
986 const bool reinterpret_input_as_3d =
gemm_info.reinterpret_input_as_3d;
987 const bool reinterpret_output_as_3d =
gemm_info.depth_output_gemm3d != 0;
988 const unsigned int depth_output_gemm3d = reinterpret_output_as_3d ?
gemm_info.depth_output_gemm3d : 1;
992 if(!reinterpret_input_as_3d && !reinterpret_output_as_3d)
1004 output_shape.set(2, reinterpret_output_as_3d ? depth_output_gemm3d : batch_size);
1005 output_shape.set(3, reinterpret_output_as_3d ? batch_size : 1);
1052 if(gemm_3d_depth > 1)
1080 int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask)
1123 unsigned int new_width =
input[
idx_width] *
static_cast<unsigned int>(block_x);
1124 unsigned int new_height =
input[
idx_height] *
static_cast<unsigned int>(block_y);
1125 const unsigned int width_crop = crop_info.left + crop_info.right;
1126 const unsigned int height_crop = crop_info.top + crop_info.bottom;
1129 new_width -= width_crop;
1130 new_height -= height_crop;
1174 empty_shape.
set(0, 0);
1179 if(axis >
input->tensor_shape().num_dimensions())
1184 size_t axis_size = out_shape[axis];
1187 if(axis_size % num_splits)
1192 out_shape[axis] = axis_size / num_splits;
1220 output_shape.set(idx_batch,
input->tensor_shape()[idx_batch] * block_x * block_y);
1243 output_shape.set(idx_depth,
input->tensor_shape()[idx_depth] * (block_shape * block_shape));
1260 const int num_priors =
info.aspect_ratios().size() *
info.min_sizes().size() +
info.max_sizes().size();
1279 for(
size_t dim = 0; dim < padding.size(); ++dim)
1281 const auto &padding_pair = padding[dim];
1283 padded_shape.
set(dim, padding_pair.first + shape_on_index + padding_pair.second);
1285 return padded_shape;
1298 for(
size_t dim = 0; dim < multiples.size(); ++dim)
1348 return scale_out_shape;
1357 template <
typename T>
1360 return data->info()->tensor_shape();
1403 template <
typename T>
1408 #if defined(ARM_COMPUTE_ASSERTS_ENABLED)
1410 for(
unsigned int i = 0; i <
MAX_DIMS; ++i)
1424 #endif // defined(ARM_COMPUTE_ASSERTS_ENABLED)
1427 size_t new_size = 0;
1431 new_size +=
shape[axis];
1434 out_shape.
set(axis, new_size);
1452 shape_out.
set(axis, num_tensors);
1454 unsigned int i_shift = 0;
1494 const size_t pad_top = conv3d_info.
padding.
top;
1501 const size_t stride_x = conv3d_info.
stride.
x();
1502 const size_t stride_y = conv3d_info.
stride.
y();
1503 const size_t stride_z = conv3d_info.
stride.
z();
1505 int output_width_size = 0;
1506 int output_height_size = 0;
1507 int output_depth_size = 0;
1512 output_width_size =
static_cast<int>(std::floor((
static_cast<float>(
src[
width_dim] + pad_left + pad_right - (dilation_x * (weights[
weights_width_dim] - 1) + 1)) / stride_x) + 1));
1513 output_height_size =
static_cast<int>(std::floor((
static_cast<float>(
src[
height_dim] + pad_top + pad_bottom - (dilation_y * (weights[
weights_height_dim] - 1) + 1)) / stride_y) + 1));
1514 output_depth_size =
static_cast<int>(std::floor((
static_cast<float>(
src[
depth_dim] + pad_front + pad_back - (dilation_z * (weights[
weights_depth_dim] - 1) + 1)) / stride_z) + 1));
1517 output_width_size =
static_cast<int>(std::ceil((
static_cast<float>(
src[
width_dim] + pad_left + pad_right - (dilation_x * (weights[
weights_width_dim] - 1) + 1)) / stride_x) + 1));
1518 output_height_size =
static_cast<int>(std::ceil((
static_cast<float>(
src[
height_dim] + pad_top + pad_bottom - (dilation_y * (weights[
weights_height_dim] - 1) + 1)) / stride_y) + 1));
1519 output_depth_size =
static_cast<int>(std::ceil((
static_cast<float>(
src[
depth_dim] + pad_front + pad_back - (dilation_z * (weights[
weights_depth_dim] - 1) + 1)) / stride_z) + 1));
1551 int output_width = 0;
1552 int output_height = 0;
1553 int output_depth = 0;
1556 pool_size_depth, pool3d_info);
1558 ARM_COMPUTE_ERROR_ON_MSG((output_width < 1 || output_height < 1 || output_depth < 1),
"Calculated output dimension size is invalid");
1562 output_shape.set(idx_depth,
static_cast<size_t>(output_depth));
1581 const auto input_num_dims =
input_shape.num_dimensions();
1590 for(; dim_no < actual_axis; ++dim_no)
1595 for(; dim_no < actual_axis + indices_num_dims; ++dim_no)
1597 output_shape.set(dim_no, indices_shape[dim_no - actual_axis]);
1600 for(; dim_no < input_num_dims + indices_num_dims - 1; ++dim_no)
@ 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.
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)
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.
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 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.
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.
const size_t weights_width
TensorShape compute_rnn_shape(const ITensorInfo *input, const unsigned int batch_size)
Calculate the RNN shape of a tensor.
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.
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.
#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.
const auto 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-2023 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.
const size_t weights_height
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.
Padding and stride information class.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
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.
ROI Pooling Layer Information class.
const size_t input_height
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.