47 void batch_concat(
const ITensor *
src, ITensor *
dst,
unsigned int batch_offset,
const Window &window)
50 uint8_t *src_ptr = src->buffer() + src->info()->offset_first_element_in_bytes();
53 uint8_t *dst_ptr = dst->buffer() + dst->info()->offset_first_element_in_bytes() + batch_offset * dst->info()->strides_in_bytes()[3];
55 const auto window_start_x =
static_cast<int>(window.x().start());
56 const auto window_end_x =
static_cast<int>(window.x().end());
57 const int window_step_x = 16 / dst->info()->element_size();
61 win.set(3, Window::Dimension(0, src->info()->tensor_shape()[3], 1));
63 Iterator src_it(src, win);
64 Iterator dst_it(dst, win);
67 const UniformQuantizationInfo src_qinfo = src->info()->quantization_info().uniform();
68 const UniformQuantizationInfo dst_qinfo = dst->info()->quantization_info().uniform();
73 const auto in_ptr =
reinterpret_cast<const uint8_t *
>(src_ptr + src_it.offset());
74 const auto out_ptr =
reinterpret_cast<uint8_t *
>(dst_ptr + dst_it.offset());
76 int x = window_start_x;
77 for(; x <= (window_end_x - window_step_x); x += window_step_x)
83 for(; x < window_end_x; ++x)
94 const auto in_ptr =
reinterpret_cast<const int8_t *
>(src_ptr + src_it.offset());
95 const auto out_ptr =
reinterpret_cast<int8_t *
>(dst_ptr + dst_it.offset());
96 int x = window_start_x;
97 for(; x <= (window_end_x - window_step_x); x += window_step_x)
102 for(; x < window_end_x; ++x)
113 const auto in_ptr =
reinterpret_cast<const T *
>(src_ptr + src_it.offset());
114 const auto out_ptr =
reinterpret_cast<T *
>(dst_ptr + dst_it.offset());
116 int x = window_start_x;
117 for(; x <= (window_end_x - window_step_x); x += window_step_x)
123 for(; x < window_end_x; ++x)
125 *(out_ptr + x) = *(in_ptr + x);
132 Status validate_arguments(
const ITensorInfo *src,
unsigned int batch_offset,
const ITensorInfo *dst)
155 _batch_offset = batch_offset;
163 _func = &batch_concat<uint8_t>;
168 _func = &batch_concat<uint16_t>;
173 _func = &batch_concat<uint32_t>;
181 ICpuKernel::configure(win);
185 unsigned int batch_offset,
207 return "CpuConcatenateBatchKernel";
Window calculate_max_window(const ValidRegion &valid_region, const Steps &steps, bool skip_border, BorderSize border_size)
const Window & window() const
The maximum window the kernel can be executed on.
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.
float32x4x2_t vdequantize(const uint8x8_t &qv, const UniformQuantizationInfo &qi)
Dequantize a neon vector holding 8 quantized values.
1 channel, 1 U8 per channel
uint8x16_t vloadq(const uint8_t *ptr)
#define ARM_COMPUTE_RETURN_ON_ERROR(status)
Checks if a status contains an error and returns it.
virtual DataType data_type() const =0
Data type used for each element of the tensor.
1 channel, 1 F32 per channel
#define ARM_COMPUTE_ERROR_ON(cond)
If the condition is true then an error message is printed and an exception thrown.
Store the tensor's metadata.
#define ARM_COMPUTE_ERROR_THROW_ON(status)
1 channel, 1 U16 per channel
#define ARM_COMPUTE_RETURN_ERROR_ON(cond)
If the condition is true, an error is returned.
SimpleTensor< float > src
Copyright (c) 2017-2021 Arm Limited.
1 channel, 1 F16 per channel
#define ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(...)
1 channel, 1 S32 per channel
const ITensor * get_const_tensor(int id) const
Get constant tensor of a given id.
static constexpr size_t DimX
Alias for dimension 0 also known as X dimension.
#define ARM_COMPUTE_UNUSED(...)
To avoid unused variables warnings.
1 channel, 1 U32 per channel
const char * name() const override
Name of the kernel.
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
Class to describe a number of elements in each dimension.
#define ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(k)
1 channel, 1 S16 per channel
void run_op(ITensorPack &tensors, const Window &window, const ThreadInfo &info) override
Execute the kernel on the passed window.
static constexpr size_t DimY
Alias for dimension 1 also known as Y dimension.
ScaleKernelInfo info(interpolation_policy, default_border_mode, PixelValue(), sampling_policy, false)
ITensor * get_tensor(int id)
Get tensor of a given id from the pac.
Information about executing thread and CPU.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_SHAPES(...)
static Status validate(const ITensorInfo *src, unsigned int batch_offset, const ITensorInfo *dst)
Static function to check if given info will lead to a valid configuration.
static constexpr size_t DimZ
Alias for dimension 2 also known as Z dimension.
#define ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(...)
uint8x8_t vquantize(const float32x4x2_t &qv, const UniformQuantizationInfo &qi)
Quantize a neon vector holding 8 floating point values.
void vstore(uint8_t *ptr, uint8x8_t val)
float dequantize_qasymm8_signed(int8_t value, const INFO_TYPE &qinfo)
Dequantize a value given a signed 8-bit asymmetric quantization scheme.
#define ARM_COMPUTE_ERROR_ON_NULLPTR(...)
void execute_window_loop(const Window &w, L &&lambda_function, Ts &&... iterators)
Iterate through the passed window, automatically adjusting the iterators and calling the lambda_funct...
quantized, asymmetric fixed-point 8-bit number signed
Includes all wrapper headers at once.
int8x8_t vquantize_signed(const float32x4x2_t &qv, const UniformQuantizationInfo &qi)
Quantize a neon vector holding 8 floating point values.
DataType
Available data types.
Describe a multidimensional execution window.
#define ARM_COMPUTE_ERROR_ON_INVALID_SUBWINDOW(f, s)
void configure(const ITensorInfo *src, unsigned int batch_offset, ITensorInfo *dst)
Configure kernel for a given list of arguments.