23.08
|
Go to the documentation of this file.
50 const auto width_out =
static_cast<int>(
dst_shape[0]);
51 const auto height_out =
static_cast<int>(
dst_shape[1]);
52 const auto z_out =
static_cast<int>(
dst_shape[2]);
53 const auto batch_out =
static_cast<int>(
dst_shape[3]);
57 for(
int z = 0; z < z_out; ++z)
59 for(
int y = 0; y < height_out; ++y)
61 for(
int x = 0; x < width_out; ++x)
63 const int x_c = x + crop_info.
left;
64 const int y_c = y + crop_info.
top;
65 const int in_batch =
batch + ((x_c % block_shape[0]) + (y_c % block_shape[1]) * (block_shape[0])) *
dst_shape[3];
66 const int in_x = x_c / block_shape[0];
67 const int in_y = y_c / block_shape[1];
68 const int in_pos = in_x +
src.shape()[0] * in_y + z *
src.shape()[0] *
src.shape()[1] + in_batch *
src.shape()[0] *
src.shape()[1] *
src.shape()[2];
69 result[out_pos] =
src[in_pos];
@ NCHW
Num samples, channels, height, width.
SimpleTensor< float > src
size_t top
Padding across the height dimension on the top, in elements.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
size_t left
Padding across the width dimension on the left, in elements.
bool have_different_dimensions(const Dimensions< T > &dim1, const Dimensions< T > &dim2, unsigned int upper_dim)
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
Simple tensor object that stores elements in a consecutive chunk of memory.
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.
Padding and stride information class.
SimpleTensor< T > batch_to_space(const SimpleTensor< T > &src, const std::vector< int32_t > &block_shape, const CropInfo &crop_info, const TensorShape &dst_shape)