40 SimpleTensor<T> widthconcatenate_layer(
const std::vector<SimpleTensor<T>> &srcs, SimpleTensor<T> &
dst)
43 std::vector<TensorShape> shapes;
44 shapes.reserve(srcs.size());
45 for(
const auto &
src : srcs)
47 shapes.emplace_back(
src.shape());
51 const int width_out = dst.shape().x();
53 std::fill_n(dst.data(), dst.num_elements(), 0);
54 for(
const auto &
src : srcs)
58 const int width =
src.shape().x();
59 const int height =
src.shape().y();
60 const int depth =
src.shape().z();
61 const int upper_dims =
src.shape().total_size() / (width * height * depth);
63 const T *src_ptr =
src.data();
64 T *dst_ptr = dst.data();
66 for(
int u = 0; u < upper_dims; ++u)
68 for(
int d = 0; d < depth; ++d)
70 for(
int r = 0; r < height; ++r)
72 const int offset = u * height * depth + d * height + r;
75 const UniformQuantizationInfo iq_info =
src.quantization_info().uniform();
76 const UniformQuantizationInfo oq_info = dst.quantization_info().uniform();
80 std::transform(src_ptr, src_ptr + width, dst_ptr + width_offset + offset * width_out, [&](T
t)
88 std::transform(src_ptr, src_ptr + width, dst_ptr + width_offset + offset * width_out, [&](T
t)
98 std::copy(src_ptr, src_ptr + width, dst_ptr + width_offset + offset * width_out);
104 width_offset += width;
109 template SimpleTensor<float> widthconcatenate_layer(
const std::vector<SimpleTensor<float>> &srcs, SimpleTensor<float> &dst);
110 template SimpleTensor<half> widthconcatenate_layer(
const std::vector<SimpleTensor<half>> &srcs, SimpleTensor<half> &dst);
111 template SimpleTensor<uint8_t> widthconcatenate_layer(
const std::vector<SimpleTensor<uint8_t>> &srcs, SimpleTensor<uint8_t> &dst);
112 template SimpleTensor<int8_t> widthconcatenate_layer(
const std::vector<SimpleTensor<int8_t>> &srcs, SimpleTensor<int8_t> &dst);
115 template <
typename T>
122 return widthconcatenate_layer(srcs, dst);
131 return reference::permute<T>(widthconcatenate_layer(srcs, dst),
PermutationVector(1
U, 0
U));
149 auto ret = reference::permute<T>(widthconcatenate_layer(srcs, dst),
PermutationVector(3
U, 2
U, 1
U, 0
U));
bool is_data_type_quantized(DataType dt)
Check if a given data type is of quantized type.
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
float dequantize_qasymm8(uint8_t value, const INFO_TYPE &qinfo)
Dequantize a value given an unsigned 8-bit asymmetric quantization scheme.
uint8_t quantize_qasymm8(float value, const INFO_TYPE &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
Quantize a value given an unsigned 8-bit asymmetric quantization scheme.
#define ARM_COMPUTE_ERROR(msg)
Print the given message then throw an std::runtime_error.
Strides PermutationVector
Permutation vector.
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
SimpleTensor< T > copy(const SimpleTensor< T > &src, const TensorShape &output_shape)
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
int8_t quantize_qasymm8_signed(float value, const INFO_TYPE &qinfo, RoundingPolicy rounding_policy=RoundingPolicy::TO_NEAREST_UP)
Quantize a value given a signed 8-bit asymmetric quantization scheme.
quantized, asymmetric fixed-point 8-bit number unsigned
Simple tensor object that stores elements in a consecutive chunk of memory.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
SimpleTensor< T > concatenate_layer(std::vector< SimpleTensor< T >> &srcs, SimpleTensor< T > &dst, unsigned int axis)
float dequantize_qasymm8_signed(int8_t value, const INFO_TYPE &qinfo)
Dequantize a value given a signed 8-bit asymmetric quantization scheme.