45 const auto width_in =
static_cast<int>(src.
shape()[0]);
46 const auto height_in =
static_cast<int>(src.
shape()[1]);
47 const auto z_in =
static_cast<int>(src.
shape()[2]);
48 const auto batch_in =
static_cast<int>(src.
shape()[3]);
50 for(
int batch = 0; batch < batch_in; ++batch)
52 for(
int z = 0; z < z_in; ++z)
54 for(
int y = 0; y < height_in; ++y)
56 for(
int x = 0; x < width_in; ++x)
58 const int r = src.
shape()[3] / (block_shape[0] * block_shape[1]);
59 const int out_x = (block_shape[0] * x + (batch / r) % block_shape[0]);
60 const int out_y = (block_shape[1] * y + (batch / r) / block_shape[0]);
61 const int out_pos = out_x + dst_shape[0] * out_y + z * dst_shape[0] * dst_shape[1] + (batch % r) * dst_shape[0] * dst_shape[1] * dst_shape[2];
62 result[out_pos] = src[in_pos];
DataType data_type() const override
Data type of the tensor.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
TensorShape shape() const override
Shape of the tensor.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
Simple tensor object that stores elements in a consecutive chunk of memory.
SimpleTensor< T > batch_to_space(const SimpleTensor< T > &src, const SimpleTensor< int32_t > &block_shape, const TensorShape &dst_shape)