42 const auto cols =
static_cast<int>(src.
shape()[0]);
43 const auto rows =
static_cast<int>(src.
shape()[1]);
44 const auto depth =
static_cast<int>(src.
shape()[2]);
45 const int upper_dims = src.
shape().total_size() / (cols *
rows * depth);
47 for(
int r = 0; r < upper_dims; ++r)
49 for(
int i = 0; i < depth; ++i)
51 for(
int k = 0; k <
rows; ++k)
53 for(
int l = 0; l <
cols; ++l)
55 const int pos = l + k * cols + i * rows * cols + r * cols * rows * depth;
56 result[pos] = (src[pos] - mean[i]) / std[i];
70 SimpleTensor<float> dst_tmp = normalize_planar_yuv_layer<float>(src_tmp, mean_tmp, std_tmp);
81 SimpleTensor<float> dst_tmp = normalize_planar_yuv_layer<float>(src_tmp, mean_tmp, std_tmp);
SimpleTensor< int8_t > normalize_planar_yuv_layer< int8_t >(const SimpleTensor< int8_t > &src, const SimpleTensor< int8_t > &mean, const SimpleTensor< int8_t > &std)
DataType data_type() const override
Data type of the tensor.
SimpleTensor< float > convert_from_asymmetric(const SimpleTensor< uint8_t > &src)
TensorShape shape() const override
Shape of the tensor.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
SimpleTensor< T > normalize_planar_yuv_layer(const SimpleTensor< T > &src, const SimpleTensor< T > &mean, const SimpleTensor< T > &std)
Simple tensor object that stores elements in a consecutive chunk of memory.
QuantizationInfo quantization_info() const override
Quantization info in case of asymmetric quantized type.
SimpleTensor< uint8_t > normalize_planar_yuv_layer< uint8_t >(const SimpleTensor< uint8_t > &src, const SimpleTensor< uint8_t > &mean, const SimpleTensor< uint8_t > &std)