40 std::vector<TensorShape> shapes;
41 shapes.reserve(srcs.size());
42 for(
const auto &
src : srcs)
44 shapes.emplace_back(
src.shape());
49 const int width_out =
dst.shape().x();
50 const int height_out =
dst.shape().y();
51 const int depth_out =
dst.shape().z();
52 const int out_stride_z = width_out * height_out;
53 const int batches =
dst.shape().total_size_upper(3);
56 return tensor.quantization_info() !=
dst.quantization_info();
62 #pragma omp parallel for
69 for(
const auto &
src : srcs)
72 const auto num_elems_in_slice((
dst.num_elements() / depth_out) *
src.shape().z());
76 std::transform(ptr_slice, ptr_slice + num_elems_in_slice, ptr_slice, [&](T)
86 std::fill_n(
dst.data(),
dst.num_elements(), 0);
89 for(
const auto &
src : srcs)
94 const int width =
src.shape().x();
95 const int height =
src.shape().y();
96 const int depth =
src.shape().z();
97 const int x_diff = (width_out - width) / 2;
98 const int y_diff = (height_out - height) / 2;
100 const T *src_ptr =
src.data();
104 const size_t offset_to_first_element =
b * out_stride_z * depth_out + depth_offset * out_stride_z + y_diff * width_out + x_diff;
106 for(
int d = 0; d < depth; ++d)
108 for(
int r = 0; r < height; ++r)
114 std::transform(src_ptr, src_ptr + width,
dst.data() + offset_to_first_element + d * out_stride_z + r * width_out, [&](T
t)
116 const float dequantized_input = dequantize_qasymm8(t, iq_info);
117 return quantize_qasymm8(dequantized_input, oq_info);
123 std::copy(src_ptr, src_ptr + width,
dst.data() + offset_to_first_element + d * out_stride_z + r * width_out);
130 depth_offset += depth;