MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / batch_concat

Function batch_concat

src/cpu/kernels/CpuConcatenateBatchKernel.cpp:50–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48{
49template <typename T>
50void batch_concat(const ITensor *src, ITensor *dst, unsigned int batch_offset, const Window &window)
51{
52 // Offset src
53 uint8_t *src_ptr = src->buffer() + src->info()->offset_first_element_in_bytes();
54
55 // Offset dst
56 uint8_t *dst_ptr = dst->buffer() + dst->info()->offset_first_element_in_bytes() +
57 batch_offset * dst->info()->strides_in_bytes()[3];
58
59 const auto window_start_x = static_cast<int>(window.x().start());
60 const auto window_end_x = static_cast<int>(window.x().end());
61 const int window_step_x = 16 / dst->info()->element_size();
62
63 Window win{window};
64 win.set(Window::DimX, Window::Dimension(0, 1, 1));
65 win.set(3, Window::Dimension(0, src->info()->tensor_shape()[3], 1));
66
67 Iterator src_it(src, win);
68 Iterator dst_it(dst, win);
69
70 const DataType dt = src->info()->data_type();
71 const UniformQuantizationInfo src_qinfo = src->info()->quantization_info().uniform();
72 const UniformQuantizationInfo dst_qinfo = dst->info()->quantization_info().uniform();
73 if (dt == DataType::QASYMM8 && src_qinfo != dst_qinfo)
74 {
75 execute_window_loop(
76 win,
77 [&](const Coordinates &)
78 {
79 const auto in_ptr = reinterpret_cast<const uint8_t *>(src_ptr + src_it.offset());
80 const auto out_ptr = reinterpret_cast<uint8_t *>(dst_ptr + dst_it.offset());
81
82 int x = window_start_x;
83 for (; x <= (window_end_x - window_step_x); x += window_step_x)
84 {
85 wrapper::vstore(out_ptr, vquantize(vdequantize(wrapper::vloadq(in_ptr), src_qinfo), dst_qinfo));
86 }
87
88 // Compute left-over elements
89 for (; x < window_end_x; ++x)
90 {
91 *(out_ptr + x) = quantize_qasymm8(dequantize_qasymm8(*(in_ptr + x), src_qinfo), dst_qinfo);
92 }
93 },
94 src_it, dst_it);
95 }
96 else if (dt == DataType::QASYMM8_SIGNED && src_qinfo != dst_qinfo)
97 {
98 execute_window_loop(
99 win,
100 [&](const Coordinates &)
101 {
102 const auto in_ptr = reinterpret_cast<const int8_t *>(src_ptr + src_it.offset());
103 const auto out_ptr = reinterpret_cast<int8_t *>(dst_ptr + dst_it.offset());
104 int x = window_start_x;
105 for (; x <= (window_end_x - window_step_x); x += window_step_x)
106 {
107 wrapper::vstore(out_ptr,

Callers

nothing calls this directly

Calls 15

vquantize_signedFunction · 0.85
quantize_qasymm8_signedFunction · 0.85
offsetMethod · 0.80
vquantizeFunction · 0.70
DimensionClass · 0.50
vdequantizeFunction · 0.50
quantize_qasymm8Function · 0.50
dequantize_qasymm8Function · 0.50
bufferMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected