24 #ifndef ARM_COMPUTE_MISC_SHAPE_CALCULATOR_H 25 #define ARM_COMPUTE_MISC_SHAPE_CALCULATOR_H 41 namespace shape_calculator
63 std::sort(axis_local.
begin(), axis_local.
begin() + reduction_ops);
64 for(
int i = 0; i < reduction_ops; ++i)
72 for(
int i = 0; i < reduction_ops; ++i)
74 out_shape.
set(axis_local[i], 1);
95 output_shape.
set(idx_w, conv_w);
96 output_shape.
set(idx_h, conv_h);
97 output_shape.
set(idx_c, input.
x() / (conv_w * conv_h));
162 const size_t tmp_dim = weights_reshaped[0];
163 weights_reshaped.set(0, weights_reshaped[1]);
164 weights_reshaped.set(1, tmp_dim + (
has_bias ? 1 : 0));
170 return weights_reshaped;
192 const unsigned int num_horiz_blocks = std::ceil(input_width / static_cast<float>(lhs_info.
k0));
193 const unsigned int num_vert_blocks = std::ceil(input_height / static_cast<float>(lhs_info.
m0));
196 const unsigned int block_size = lhs_info.
m0 * lhs_info.
k0;
199 const unsigned int output_width = block_size * num_horiz_blocks * lhs_info.
v0;
200 const unsigned int output_height = std::ceil(num_vert_blocks / static_cast<float>(lhs_info.
v0));
203 lhs_shape.
set(0, output_width);
204 lhs_shape.
set(1, output_height);
206 if((reinterpret_input_as_3d) && (lhs_shape.num_dimensions() > 2))
236 const unsigned int num_horiz_blocks = std::ceil(input_width / static_cast<float>(rhs_info.
n0));
237 const unsigned int num_vert_blocks = std::ceil(input_height / static_cast<float>(rhs_info.
k0));
240 const unsigned int block_size = rhs_info.
n0 * rhs_info.
k0;
243 const unsigned int output_width = block_size * num_vert_blocks * rhs_info.
h0;
244 const unsigned int output_height = std::ceil(num_horiz_blocks / static_cast<float>(rhs_info.
h0));
247 rhs_shape.
set(0, output_width);
248 rhs_shape.
set(1, output_height);
265 const int interleave_width = 4 * mult_interleave4x4_height;
267 shape_interleaved_a.
set(0, a.
dimension(0) * interleave_width);
268 if(reinterpret_input_as_3d)
271 const int height = std::ceil(M / static_cast<float>(interleave_width));
272 shape_interleaved_a.set(1, height);
278 if(shape_interleaved_a.num_dimensions() > 2)
280 shape_interleaved_a.remove_dimension(2);
285 shape_interleaved_a.set(1, std::ceil(a.
dimension(1) /
static_cast<float>(interleave_width)));
288 return shape_interleaved_a;
302 shape_transposed1xW_b.
set(1, std::ceil(b.
dimension(0) / 16.f));
304 return shape_transposed1xW_b;
321 const size_t transpose_width = (16 / b.
element_size()) * mult_transpose1xW_width;
322 shape_transposed1xW_b.
set(0, b.
dimension(1) * transpose_width);
323 shape_transposed1xW_b.
set(1, static_cast<size_t>(std::ceil(b.
dimension(0) /
static_cast<float>(transpose_width))));
325 return shape_transposed1xW_b;
337 if(shape_vector_sum_col.num_dimensions() > 1)
342 return shape_vector_sum_col;
355 if(shape_vector_sum_row.num_dimensions() > 1)
360 return shape_vector_sum_row;
390 col2im_shape.set(width_idx, convolved_dims.
width);
391 col2im_shape.set(height_idx, convolved_dims.
height);
410 return shape_transposed;
435 unsigned int output_width = 0;
436 unsigned int output_height = 0;
462 std::pair<unsigned int, unsigned int> &out_dims, uint32_t &padx, uint32_t &pady)
469 unsigned int out_x = (input.
dimension(idx_w) - 1) * sx + 1;
470 unsigned int out_y = (input.
dimension(idx_h) - 1) * sy + 1;
473 padx = out_dims.first - (out_x - weights.
dimension(idx_w) + 1);
474 pady = out_dims.second - (out_y - weights.
dimension(idx_h) + 1);
479 scale_out_shape.
set(idx_w, out_x);
480 scale_out_shape.
set(idx_h, out_y);
482 return scale_out_shape;
505 out_shape.set(width_idx, out_dims.first);
506 out_shape.set(height_idx, out_dims.second);
542 output_shape.set(1, (out_dims.first * out_dims.second));
543 if(batch_size_on_z &&
output_shape.num_dimensions() >= 3)
587 if(axis < input->num_dimensions())
659 const unsigned int height = num_tiles.area();
660 const unsigned int depth = input_tile_size.
area();
685 unsigned int output_width = 0;
686 unsigned int output_height = 0;
693 const unsigned int out_w = output_width;
694 const unsigned int out_h = output_height;
695 const unsigned int out_c = input.
dimension(0);
723 const unsigned int weights_out_channel = weights_shape[3];
724 unsigned int output_width = 0;
725 unsigned int output_height = 0;
726 std::tie(output_width, output_height) =
scaled_dimensions(input_width, input_height, weights_width, weights_height, conv_info);
788 pool_size_x, pool_size_y,
793 output_shape.set(idx_width, static_cast<size_t>(pooled_w));
794 output_shape.set(idx_height, static_cast<size_t>(pooled_h));
813 const unsigned int stride_x = pad_stride_info.
stride().first;
814 const unsigned int stride_y = pad_stride_info.
stride().second;
816 const int pad_left = pad_stride_info.
pad_left();
817 const int pad_top = pad_stride_info.
pad_top();
818 const int pad_right = pad_stride_info.
pad_right();
819 const int pad_bottom = pad_stride_info.
pad_bottom();
822 const unsigned int out_width = (input_shape[
idx_width] - 1) * stride_x - pad_left - pad_right + pool_info.
pool_size.
width;
823 const unsigned int out_height = (input_shape[idx_height] - 1) * stride_y - pad_top - pad_bottom + pool_info.
pool_size.
height;
825 output_shape.
set(idx_width, out_width);
826 output_shape.
set(idx_height, out_height);
883 const int depth_output_gemm3d = reinterpret_output_as_3d ? reshape_info.
depth_output_gemm3d() : 1;
888 const int dim0 = is_interleaved_transposed ? reshape_info.
n() : input1.
dimension(0);
889 const int dim1 = is_interleaved_transposed ? reshape_info.
m() / depth_output_gemm3d : m / depth_output_gemm3d;
891 const int dim3 = reinterpret_input_as_3d ? 1 : input0.
tensor_shape()[3];
897 output_shape.set(2, reinterpret_output_as_3d ? depth_output_gemm3d : dim2);
898 output_shape.set(3, reinterpret_output_as_3d ? dim2 : dim3);
899 output_shape.set(4, reinterpret_output_as_3d ? dim3 : 1);
919 const int depth_output_gemm3d = reinterpret_output_as_3d ? gemm_info.
depth_output_gemm3d() : 1;
923 if(!reinterpret_input_as_3d && !reinterpret_output_as_3d)
935 output_shape.set(2, reinterpret_output_as_3d ? depth_output_gemm3d : batch_size);
936 output_shape.set(3, reinterpret_output_as_3d ? batch_size : 1);
957 const unsigned int depth_output_gemm3d = reinterpret_output_as_3d ? gemm_info.
depth_output_gemm3d : 1;
961 if(!reinterpret_input_as_3d && !reinterpret_output_as_3d)
973 output_shape.set(2, reinterpret_output_as_3d ? depth_output_gemm3d : batch_size);
974 output_shape.set(3, reinterpret_output_as_3d ? batch_size : 1);
993 if(gemm_3d_depth > 1)
1000 output_shape.set(1, input.
tensor_shape().
y() / gemm_3d_depth);
1001 output_shape.set(2, gemm_3d_depth);
1021 int32_t begin_mask, int32_t end_mask, int32_t shrink_axis_mask)
1086 output_shape.set(idx_width, input_shape[idx_width] * block);
1087 output_shape.set(idx_height, input_shape[idx_height] * block);
1088 output_shape.set(idx_channel, input_shape[idx_channel] / (block * block));
1104 empty_shape.
set(0, 0);
1114 size_t axis_size = out_shape[axis];
1117 if(axis_size % num_splits)
1122 out_shape[axis] = axis_size / num_splits;
1209 for(
size_t dim = 0; dim < padding.size(); ++dim)
1211 const auto &padding_pair = padding[dim];
1212 const uint32_t shape_on_index = (padded_shape.
num_dimensions() <= dim) ? 1 : input_shape[dim];
1213 padded_shape.
set(dim, padding_pair.first + shape_on_index + padding_pair.second);
1215 return padded_shape;
1228 for(
size_t dim = 0; dim < multiples.size(); ++dim)
1230 tiled_shape.
set(dim, input_shape[dim] * multiples[dim]);
1273 const unsigned int out_x = input.
dimension(idx_width) * info.
x();
1274 const unsigned int out_y = input.
dimension(idx_height) * info.
y();
1275 scale_out_shape.set(idx_width, out_x);
1276 scale_out_shape.set(idx_height, out_y);
1278 return scale_out_shape;
1287 template <
typename T>
1290 return data->info()->tensor_shape();
1333 template <
typename T>
1338 #if defined(ARM_COMPUTE_ASSERTS_ENABLED) 1340 for(
unsigned int i = 0; i <
MAX_DIMS; ++i)
1347 for(
const auto &tensor : input)
1354 #endif // defined(ARM_COMPUTE_ASSERTS_ENABLED) 1357 size_t new_size = 0;
1358 for(
const auto &tensor : input)
1361 new_size += shape[axis];
1364 out_shape.
set(axis, new_size);
1382 shape_out.
set(axis, num_tensors);
1384 unsigned int i_shift = 0;
1424 const size_t pad_top = conv3d_info.
padding.
top;
1431 const size_t stride_x = conv3d_info.
stride.
x();
1432 const size_t stride_y = conv3d_info.
stride.
y();
1433 const size_t stride_z = conv3d_info.
stride.
z();
1435 int output_width_size = 0;
1436 int output_height_size = 0;
1437 int output_depth_size = 0;
1442 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));
1443 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));
1444 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));
1447 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));
1448 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));
1449 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));
1459 output_shape.set(channel_dim, weights[weights_CHout_dim]);
1470 output_shape[actual_axis] = indices_shape[0];
virtual size_t num_dimensions() const =0
The number of dimensions of the tensor (rank)
void shift_right(size_t step)
Shifts right the tensor shape increasing its dimensions.
TensorShape compute_slice_shape(const TensorShape &input_shape, const Coordinates &starts, const Coordinates &ends)
Calculate the slice 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.
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.
TensorShape compute_depthwise_convolution_shape(const ITensorInfo &input, const ITensorInfo &weights, const ConvolutionInfo &info)
Calculate the depthwise convolution output shape of a tensor.
constexpr unsigned int channel_dim
void remove_dimension(size_t n)
Accessor to remove the dimension n from the tensor shape.
Descriptor used by the 3d Convolution function.
TensorShape compute_winograd_input_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd input transform shape.
DataLayout output_data_layout
Data layout to use for the output tensor once the convolution has been applied (NCHW or NHWC) ...
TensorShape calculate_unstack_shape(TensorShape input_shape, unsigned int axis)
Calculate the unstack shape of a tensor.
TensorShape compute_transpose1xW_with_element_size_shape(const ITensorInfo &b, int mult_transpose1xW_width=1)
Calculate the transposed 1xW width element shape.
const size_t weights_height
Descriptor used by the GEMM kernels.
TensorShape compute_stack_shape(const ITensorInfo &a, unsigned int axis, unsigned int num_tensors)
Calculate the stack output shape of a tensor.
virtual size_t dimension(size_t index) const =0
Return the size of the requested dimension.
std::vector< PaddingInfo > PaddingList
List of padding information.
TensorShape compute_roi_align_shape(const ITensorInfo &input, const ITensorInfo &rois, ROIPoolingLayerInfo pool_info)
Calculate the output roi align shape of a tensor.
unsigned int v0
Number of vertical blocks of size (m0xk0) stored on the same output row.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
unsigned int depth_output_gemm3d
Depth of the output tensor in case is reinterpreted as 3D.
constexpr unsigned int weights_height_dim
GEMM reshape information class.
PadStrideInfo convolution_info
Convolution info (Pads, strides,...)
std::vector< float > aspect_ratios() const
Get aspect ratios.
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_reductionA_shape(const ITensorInfo &b)
Calculate the reductionA shape used in GEMMLowp.
constexpr unsigned int weights_depth_dim
TensorShape compute_softmax_shape(const ITensorInfo *input, size_t axis=1)
Calculate the softmax output shape of a tensor.
Coordinates BiStrides
Bidirectional strides.
TensorShape compute_space_to_batch_shape(const ITensorInfo *input, const int block_x, const int block_y, const Size2D &padding_left, const Size2D &padding_right)
Calculate the space to batch output shape of a tensor.
unsigned int h0
Number of horizontal blocks of size (k0xn0) stored on the same output row.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
TensorShape compute_rnn_shape(const ITensorInfo *input, const unsigned int batch_size)
Calculate the RNN shape of a tensor.
GEMM LHS (Left Hand Side) matrix information.
Store the tensor's metadata.
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_reorg_output_shape(const ITensorInfo &input, int32_t stride)
Calculate the output shape of the reorg layer given a stride.
size_t x() const
Semantic accessor for width as x.
unsigned int pooled_width() const
Get the pooled width of the layer.
unsigned int pad_top() const
Get the top padding.
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_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.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
size_t height
Height of the image region or rectangle.
TensorShape compute_min_max_shape(const ITensorInfo *input)
Calculate the min/max shape output shape of a tensor.
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.
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...
constexpr size_t MAX_DIMS
Constant value used to indicate maximum dimensions of a Window, TensorShape and Coordinates.
TensorShape compute_transposed_shape(const ITensorInfo &input)
Calculate the transposed shape of a tensor.
void permute(Dimensions< T > &dimensions, const PermutationVector &perm)
Permutes given Dimensions according to a permutation vector.
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.
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...
TensorShape compute_pool_shape(const ITensorInfo &input, PoolingLayerInfo pool_info)
Calculate the output pool shape of a tensor.
T x() const
Alias to access the size of the first dimension.
int n() const
Number of matrix B columns.
unsigned int depth_multiplier
Multiplier to apply to input's depth to retrieve the output depth.
TensorShape compute_flatten_shape(const ITensorInfo *input)
Calculate the flattened output shape of a tensor.
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
TensorShape compute_prior_box_shape(const ITensorInfo &input, const PriorBoxLayerInfo &info)
Calculate the prior box output shape of a tensor.
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 m
Number of LHS rows.
unsigned int n
Number of RHS columns.
const auto input_shape
Validate test suite is to test ARM_COMPUTE_RETURN_ON_* macros we use to check the validity of given a...
DimensionRoundingType round_type
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
size_t front
Padding across the depth dimenstion on the front, in elements.
void collapse_from(size_t start)
Collapse dimensions starting from a given point.
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.
TensorShape calculate_reduce_mean_shape(ITensorInfo *input, const Coordinates &reduction_axis, bool keep_dims)
Calculate the output tensor shape for the reduce mean operation.
GEMM RHS (Right Hand Side) matrix information.
virtual const TensorShape & tensor_shape() const =0
Size for each dimension of the tensor.
TensorShape compute_unpool_shape(const ITensorInfo &input, PoolingLayerInfo pool_info)
Calculate the output unpool shape of a tensor.
Size2D output_tile_size
Width and height of the output tile.
PadStrideInfo pad_stride_info
Convolution info (Pads, strides,...)
unsigned int n0
Number of columns processed by the matrix multiplication.
size_t height
Height of the 3D shape or object.
#define ARM_COMPUTE_ERROR_ON_MSG(cond, msg)
const unsigned int num_groups
TensorShape compute_tiled_shape(const TensorShape &input_shape, const Multiples &multiples)
Calculate the tiled shape of a tensor.
constexpr unsigned int depth_dim
std::pair< unsigned int, unsigned int > stride() const
Get the stride.
TensorShape compute_reduced_shape(const TensorShape &input, unsigned int axis, bool keep_dims=true)
Calculate the reduced shape of a tensor given an axis.
Pooling Layer Information struct.
Size2D dilation
Dilation, in elements, across x and y.
TensorShape compute_rhs_reshaped_shape(const ITensorInfo &a, const GEMMRHSMatrixInfo &rhs_info)
Calculate the Right Hand Side matrix reshaped shape.
bool reinterpret_input_as_3d
Flag used to reinterpret the input as 3D.
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.
unsigned int pad_right() const
Get the right padding.
size_t top
Padding across the height dimenstion on the top, in elements.
size_t left
Padding across the width dimenstion on the left, in elements.
size_t width
Width of the 3D shape or object.
Padding and stride information class.
virtual size_t element_size() const =0
Element size in bytes calculated as data_size() * num_channels()
std::array< T, num_max_dimensions >::iterator begin()
Returns a read/write iterator that points to the first element in the dimension array.
TensorShape compute_winograd_filter_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd filter transform shape.
const size_t weights_width
TensorShape compute_padded_shape(const TensorShape &input_shape, const PaddingList &padding)
Calculate the padded shape of a tensor.
size_t back
Padding across the depth dimenstion on the back, in elements.
Num samples, channels, height, width.
size_t y() const
Semantic accessor for height as y.
constexpr unsigned int weights_width_dim
Strides of an item in bytes.
TensorShape compute_reductionB_shape(const ITensorInfo &a)
Calculate the reductionB shape used in GEMMLowp.
constexpr unsigned int batch_dim
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
TensorShape extract_shape(T *data)
Get the tensor shape.
size_t right
Padding across the width dimenstion on the right, in elements.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
size_t depth
Depth of the 3D shape or object.
PadStrideInfo pad_stride_info
TensorShape compute_upsample_shape(const ITensorInfo &input, const Size2D &info)
Calculate the upsampled shape of a tensor.
TensorShape compute_winograd_output_transform_shape(const ITensorInfo &input, const WinogradInfo &winograd_info)
Calculate the winograd output transform shape.
TensorShape compute_conv3d_shape(const TensorShape &src, const TensorShape &weights, const Conv3dInfo &conv3d_info)
Calculate the output shape of 3d Convolution.
size_t width
Width of the image region or rectangle.
constexpr unsigned int weights_CHout_dim
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
unsigned int pooled_height() const
Get the pooled height of the layer.
TensorShape compute_weights_reshaped_shape(const ITensorInfo &weights, bool has_bias=false, unsigned int num_groups=1)
Calculate the reshaped shape of the weights.
int m() const
Number of matrix A rows.
ROI Pooling Layer Information class.
size_t get_data_layout_dimension_index(const DataLayout &data_layout, const DataLayoutDimension &data_layout_dimension)
Get the index of the given dimension.
Class for specifying the size of an image or rectangle.
unsigned int num_dimensions() const
Returns the effective dimensionality of the tensor.
std::vector< float > max_sizes() const
Get max sizes.
Num samples, height, width, channels.
const size_t input_height
TensorShape compute_batch_to_space_shape(const ITensorInfo *input, const int block_x, const int block_y)
Calculate the batch to space output shape of a tensor.
TensorShape compute_transpose1xW_shape(const ITensorInfo &b)
Calculate the transposed 1xW shape.
int depth_output_gemm3d() const
Depth (third dimension) of the output tensor to be used with the GEMM3D kernel.
Size2D kernel_size
Width and height of the kernel.
unsigned int k0
Number of partial accumulations performed by the matrix multiplication.
unsigned int m0
Number of rows processed by the matrix multiplication.
size_t z() const
Semantic accessor for depth as z.
T y() const
Alias to access the size of the second dimension.
Coordinates & convert_negative_axis(Coordinates &coords, int max_value)
Convert negative coordinates to positive in the range [0, num_dims_input].
constexpr unsigned int height_dim
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.
unsigned int pad_bottom() const
Get the bottom padding.
Size2D input_dimensions
Width and height of the input tensor before the convolution is applied.
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...
bool reinterpret_input_as_3d() const
Flag which specifies if the input tensor has to be reinterpreted as 3D.
size_t x() const
Semantic accessor for width as x.
TensorShape compute_split_shape(const ITensorInfo *input, unsigned int axis, unsigned int num_splits)
Calculate the split output shape of a tensor.
unsigned int pad_left() const
Get the left padding.
DataLayout
[DataLayout enum definition]
std::vector< uint32_t > Multiples
Information to produce a tiled version of a Tensor.
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)
Calculate the im2col output shape of a tensor.
void collapse(size_t n, size_t first=0)
Collapse the first n dimensions.
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.
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.
size_t area() const
The area of the image or rectangle calculated as (width * height)
size_t bottom
Padding across the height dimenstion on the bottom, in elements.
virtual DataLayout data_layout() const =0
Get the data layout of the tensor.
TensorShape compute_space_to_depth_shape(const ITensorInfo *input, int32_t block_shape)
Calculate the space to batch output shape of a tensor.
constexpr unsigned int width_dim
std::vector< float > min_sizes() const
Get min sizes.
size_t y() const
Semantic accessor for height as y.
TensorShape compute_gather_shape(const TensorShape &input_shape, const TensorShape &indices_shape, uint32_t actual_axis)