1 // Copyright (c) 2018 Intel Corporation
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 ///////////////////////////////////////////////////////////////////////////////////////////////////
16 #include <gtest/gtest.h>
18 #include <api/CPP/engine.hpp>
19 #include <api/CPP/input_layout.hpp>
20 #include <api/CPP/memory.hpp>
21 #include <api/CPP/broadcast.hpp>
22 #include <api/CPP/topology.hpp>
23 #include <api/CPP/network.hpp>
25 #include "test_utils/test_utils.h"
26 #include "test_utils/uniform_quantized_real_distribution.hpp"
31 using namespace cldnn;
32 using namespace ::tests;
35 void start_broadcast_test(data_types cldnn_data_type, std::vector<size_t> output_shape,
36 std::vector<size_t> input_shape, std::vector<size_t> broadcast_axes,
37 std::vector<T> golden_data)
39 size_t input_data_size = accumulate(input_shape.rbegin(), input_shape.rend(), (size_t)1, std::multiplies<size_t>());
40 EXPECT_GE(input_data_size, (size_t)1);
41 std::vector<T> input_data = {};
42 for (size_t i = 1; i <= input_data_size; ++i) {
43 input_data.push_back((T)i);
46 EXPECT_EQ(golden_data.size(), accumulate(output_shape.rbegin(), output_shape.rend(), (size_t)1, std::multiplies<size_t>()));
48 std::vector<tensor::value_type> output_4d(4, 1);
49 for(size_t i = 0; i < output_shape.size(); ++i) {
50 output_4d.at(4 - output_shape.size() + i) = (tensor::value_type)output_shape.at(i);
52 std::vector<tensor::value_type> input_4d(4, 1);
53 for(size_t i = 0; i < input_shape.size(); ++i) {
54 input_4d.at(4 - input_shape.size() + i) = (tensor::value_type)input_shape.at(i);
56 std::vector<uint16_t> fixed_b_axes;
57 size_t shift = 4 - output_shape.size();
58 for(size_t i = 0; i < shift; ++i) {
59 fixed_b_axes.push_back((uint16_t) i);
61 for(size_t i = 0; i < broadcast_axes.size(); ++i) {
62 fixed_b_axes.push_back((uint16_t) (broadcast_axes.at(i) + shift));
65 const auto& engine = get_test_engine();
66 auto input = memory::allocate(engine, {cldnn_data_type, format::bfyx, {input_4d.at(0), input_4d.at(1), input_4d.at(3), input_4d.at(2)}});
69 topology.add(input_layout("input", input.get_layout()));
70 topology.add(broadcast("output", "input", {output_4d.at(0), output_4d.at(1), output_4d.at(3), output_4d.at(2)}, fixed_b_axes));
72 set_values(input, input_data);
74 network network(engine, topology);
75 network.set_input_data("input", input);
76 auto outputs = network.execute();
78 auto output = outputs.at("output").get_memory();
79 auto output_ptr = output.pointer<T>();
81 for (tensor::value_type b = 0; b < output_4d.at(0); ++b) {
82 for (tensor::value_type f = 0; f < output_4d.at(1); ++f) {
83 for (tensor::value_type y = 0; y < output_4d.at(2); ++y) {
84 for (tensor::value_type x = 0; x < output_4d.at(3); ++x) {
85 auto output_off = ((b * output_4d.at(1) + f) * output_4d.at(2) + y) * output_4d.at(3) + x;
86 EXPECT_EQ(output_ptr[output_off], golden_data[output_off]);
93 TEST(broadcast_gpu_float, bfyx_1_to_5_w_b_axes_0) {
94 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0};
95 start_broadcast_test<float>(data_types::f32, {5}, {1}, {0}, golden_data);
98 TEST(broadcast_gpu_uint8_t, bfyx_1_to_5_w_b_axes_0) {
99 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1};
100 start_broadcast_test<uint8_t>(data_types::u8, {5}, {1}, {0}, golden_data);
103 TEST(broadcast_gpu_float, bfyx_1_to_4x5_w_b_axes_0x1) {
104 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
105 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
106 start_broadcast_test<float>(data_types::f32, {4, 5}, {1}, {0, 1}, golden_data);
109 TEST(broadcast_gpu_uint8_t, bfyx_1_to_4x5_w_b_axes_0x1) {
110 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
111 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
112 start_broadcast_test<uint8_t>(data_types::u8, {4, 5}, {1}, {0, 1}, golden_data);
115 TEST(broadcast_gpu_float, bfyx_1_to_3x4x5_w_b_axes_0x1x2) {
116 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
117 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
118 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
119 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
120 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
121 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
122 start_broadcast_test<float>(data_types::f32, {3, 4, 5}, {1}, {0, 1, 2}, golden_data);
125 TEST(broadcast_gpu_uint8_t, bfyx_1_to_3x4x5_w_b_axes_0x1x2) {
126 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
127 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
128 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
129 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
130 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
131 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
132 start_broadcast_test<uint8_t>(data_types::u8, {3, 4, 5}, {1}, {0, 1, 2}, golden_data);
135 TEST(broadcast_gpu_float, bfyx_1_to_2x3x4x5_w_b_axes_0x1x2x3) {
136 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
137 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
138 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
139 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
140 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
141 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
142 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
143 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
144 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
145 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
146 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
147 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
148 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {1}, {0, 1, 2, 3}, golden_data);
151 TEST(broadcast_gpu_uint8_t, bfyx_1_to_2x3x4x5_w_b_axes_0x1x2x3) {
152 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
153 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
154 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
155 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
156 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
157 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
158 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
159 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
160 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
161 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
162 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
163 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
164 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {1}, {0, 1, 2, 3}, golden_data);
167 TEST(broadcast_gpu_float, bfyx_1_to_5_w_o_b_axes) {
168 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0};
169 start_broadcast_test<float>(data_types::f32, {5}, {1}, {}, golden_data);
172 TEST(broadcast_gpu_uint8_t, bfyx_1_to_5_w_o_b_axes) {
173 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1};
174 start_broadcast_test<uint8_t>(data_types::u8, {5}, {1}, {}, golden_data);
177 TEST(broadcast_gpu_float, bfyx_3_to_12_w_o_b_axes) {
178 std::vector<float> golden_data = {1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 1.0, 2.0, 3.0};
179 start_broadcast_test<float>(data_types::f32, {12}, {3}, {}, golden_data);
182 TEST(broadcast_gpu_uint8_t, bfyx_3_to_12_w_o_b_axes) {
183 std::vector<uint8_t> golden_data = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3};
184 start_broadcast_test<uint8_t>(data_types::u8, {12}, {3}, {}, golden_data);
187 TEST(broadcast_gpu_float, bfyx_1x1_to_4x5_w_o_b_axes) {
188 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
189 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
190 start_broadcast_test<float>(data_types::f32, {4, 5}, {1, 1}, {}, golden_data);
193 TEST(broadcast_gpu_uint8_t, bfyx_1x1_to_4x5_w_o_b_axes) {
194 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
195 1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
196 start_broadcast_test<uint8_t>(data_types::u8, {4, 5}, {1, 1}, {}, golden_data);
199 TEST(broadcast_gpu_float, bfyx_2x3_to_8x6_w_o_b_axes) {
200 std::vector<float> golden_data = {1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 4.0, 5.0, 6.0,
201 1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 4.0, 5.0, 6.0,
202 1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 4.0, 5.0, 6.0,
203 1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 4.0, 5.0, 6.0};
204 start_broadcast_test<float>(data_types::f32, {8, 6}, {2, 3}, {}, golden_data);
207 TEST(broadcast_gpu_uint8_t, bfyx_2x3_to_8x6_w_o_b_axes) {
208 std::vector<uint8_t> golden_data = {1, 2, 3, 1, 2, 3, 4, 5, 6, 4, 5, 6,
209 1, 2, 3, 1, 2, 3, 4, 5, 6, 4, 5, 6,
210 1, 2, 3, 1, 2, 3, 4, 5, 6, 4, 5, 6,
211 1, 2, 3, 1, 2, 3, 4, 5, 6, 4, 5, 6};
212 start_broadcast_test<uint8_t>(data_types::u8, {8, 6}, {2, 3}, {}, golden_data);
215 TEST(broadcast_gpu_float, bfyx_2x3x4_to_6x6x4_w_o_b_axes) {
216 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
217 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
218 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0,
219 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0,
220 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
221 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
222 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0,
223 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0,
224 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
225 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
226 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0,
227 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0};
228 start_broadcast_test<float>(data_types::f32, {6, 6, 4}, {2, 3, 4}, {}, golden_data);
231 TEST(broadcast_gpu_uint8_t, bfyx_2x3x4_to_6x6x4_w_o_b_axes) {
232 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
233 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
234 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
235 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
236 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
237 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
238 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
239 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
240 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
241 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
242 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
243 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24};
244 start_broadcast_test<uint8_t>(data_types::u8, {6, 6, 4}, {2, 3, 4}, {}, golden_data);
247 TEST(broadcast_gpu_float, bfyx_2x3x4x5_to_2x9x8x5_w_o_b_axes) {
248 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
249 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
250 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
251 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
252 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
253 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0,
254 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
255 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0,
256 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0,
257 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0,
258 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0,
259 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0,
260 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
261 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
262 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
263 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
264 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
265 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0,
266 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
267 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0,
268 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0,
269 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0,
270 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0,
271 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0,
272 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
273 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
274 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
275 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
276 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
277 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0,
278 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
279 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0,
280 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0,
281 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0,
282 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0,
283 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0,
284 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0,
285 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0,
286 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0,
287 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0,
288 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0,
289 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0,
290 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0,
291 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0,
292 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0,
293 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0,
294 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0,
295 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0,
296 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0,
297 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0,
298 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0,
299 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0,
300 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0,
301 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0,
302 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0,
303 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0,
304 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0,
305 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0,
306 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0,
307 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0,
308 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0,
309 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0,
310 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0,
311 71.0, 72.0, 73.0, 74.0, 75.0, 76.0, 77.0, 78.0, 79.0, 80.0,
312 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0,
313 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0,
314 81.0, 82.0, 83.0, 84.0, 85.0, 86.0, 87.0, 88.0, 89.0, 90.0,
315 91.0, 92.0, 93.0, 94.0, 95.0, 96.0, 97.0, 98.0, 99.0, 100.0,
316 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0,
317 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0,
318 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0, 110.0,
319 111.0, 112.0, 113.0, 114.0, 115.0, 116.0, 117.0, 118.0, 119.0, 120.0};
320 start_broadcast_test<float>(data_types::f32, {2, 9, 8, 5}, {2, 3, 4, 5}, {}, golden_data);
323 TEST(broadcast_gpu_uint8_t, bfyx_2x3x4x5_to_2x9x8x5_w_o_b_axes) {
324 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
325 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
326 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
327 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
328 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
329 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
330 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
331 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
332 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
333 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
334 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
335 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
336 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
337 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
338 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
339 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
340 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
341 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
342 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
343 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
344 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
345 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
346 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
347 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
348 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
349 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
350 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
351 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
352 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
353 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
354 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
355 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
356 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
357 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
358 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
359 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
360 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
361 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
362 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
363 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
364 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
365 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
366 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
367 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
368 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
369 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
370 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
371 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
372 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
373 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
374 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
375 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
376 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
377 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
378 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
379 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
380 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
381 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
382 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
383 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
384 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
385 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
386 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
387 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
388 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
389 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
390 81, 82, 83, 84, 85, 86, 87, 88, 89, 90,
391 91, 92, 93, 94, 95, 96, 97, 98, 99, 100,
392 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
393 111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
394 101, 102, 103, 104, 105, 106, 107, 108, 109, 110,
395 111, 112, 113, 114, 115, 116, 117, 118, 119, 120};
396 start_broadcast_test<uint8_t>(data_types::u8, {2, 9, 8, 5}, {2, 3, 4, 5}, {}, golden_data);
399 TEST(broadcast_gpu_float, bfyx_3_to_2x3_w_b_axes_0) {
400 std::vector<float> golden_data = {1.0, 2.0, 3.0, 1.0, 2.0, 3.0};
401 start_broadcast_test<float>(data_types::f32, {2, 3}, {3}, {0}, golden_data);
404 TEST(broadcast_gpu_uint8_t, bfyx_3_to_2x3_w_b_axes_0) {
405 std::vector<uint8_t> golden_data = {1, 2, 3, 1, 2, 3};
406 start_broadcast_test<uint8_t>(data_types::u8, {2, 3}, {3}, {0}, golden_data);
409 TEST(broadcast_gpu_float, bfyx_3_to_2x6_w_b_axes_0) {
410 std::vector<float> golden_data = {1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 1.0, 2.0, 3.0};
411 start_broadcast_test<float>(data_types::f32, {2, 6}, {3}, {0}, golden_data);
414 TEST(broadcast_gpu_uint8_t, bfyx_3_to_2x6_w_b_axes_0) {
415 std::vector<uint8_t> golden_data = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3};
416 start_broadcast_test<uint8_t>(data_types::u8, {2, 6}, {3}, {0}, golden_data);
419 TEST(broadcast_gpu_float, bfyx_2_to_2x3_w_b_axes_1) {
420 std::vector<float> golden_data = {1.0, 1.0, 1.0, 2.0, 2.0, 2.0};
421 start_broadcast_test<float>(data_types::f32, {2, 3}, {2}, {1}, golden_data);
424 TEST(broadcast_gpu_uint8_t, bfyx_2_to_2x3_w_b_axes_1) {
425 std::vector<uint8_t> golden_data = {1, 1, 1, 2, 2, 2};
426 start_broadcast_test<uint8_t>(data_types::u8, {2, 3}, {2}, {1}, golden_data);
429 TEST(broadcast_gpu_float, bfyx_2_to_6x3_w_b_axes_1) {
430 std::vector<float> golden_data = {1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 1.0, 1.0, 1.0,
431 2.0, 2.0, 2.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0};
432 start_broadcast_test<float>(data_types::f32, {6, 3}, {2}, {1}, golden_data);
435 TEST(broadcast_gpu_uint8_t, bfyx_2_to_6x3_w_b_axes_1) {
436 std::vector<uint8_t> golden_data = {1, 1, 1, 2, 2, 2, 1, 1, 1,
437 2, 2, 2, 1, 1, 1, 2, 2, 2};
438 start_broadcast_test<uint8_t>(data_types::u8, {6, 3}, {2}, {1}, golden_data);
441 TEST(broadcast_gpu_float, bfyx_3x4_to_2x3x4_w_b_axes_0) {
442 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
443 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0};
444 start_broadcast_test<float>(data_types::f32, {2, 3, 4}, {3, 4}, {0}, golden_data);
447 TEST(broadcast_gpu_uint8_t, bfyx_3x4_to_2x3x4_w_b_axes_0) {
448 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
449 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
450 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4}, {3, 4}, {0}, golden_data);
453 TEST(broadcast_gpu_float, bfyx_2x4_to_2x3x4_w_b_axes_1) {
454 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0,
455 5.0, 6.0, 7.0, 8.0, 5.0, 6.0, 7.0, 8.0, 5.0, 6.0, 7.0, 8.0};
456 start_broadcast_test<float>(data_types::f32, {2, 3, 4}, {2, 4}, {1}, golden_data);
459 TEST(broadcast_gpu_uint8_t, bfyx_2x4_to_2x3x4_w_b_axes_1) {
460 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
461 5, 6, 7, 8, 5, 6, 7, 8, 5, 6, 7, 8};
462 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4}, {2, 4}, {1}, golden_data);
465 TEST(broadcast_gpu_float, bfyx_2x3_to_2x3x4_w_b_axes_2) {
466 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0,
467 4.0, 4.0, 4.0, 4.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0};
468 start_broadcast_test<float>(data_types::f32, {2, 3, 4}, {2, 3}, {2}, golden_data);
471 TEST(broadcast_gpu_uint8_t, bfyx_2x3_to_2x3x4_w_b_axes_2) {
472 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
473 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6};
474 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4}, {2, 3}, {2}, golden_data);
477 TEST(broadcast_gpu_float, bfyx_4_to_2x3x4_w_b_axes_0_1) {
478 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0,
479 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0, 1.0, 2.0, 3.0, 4.0};
480 start_broadcast_test<float>(data_types::f32, {2, 3, 4}, {4}, {0, 1}, golden_data);
483 TEST(broadcast_gpu_uint8_t, bfyx_4_to_2x3x4_w_b_axes_0_1) {
484 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4,
485 1, 2, 3, 4, 1, 2, 3, 4, 1, 2, 3, 4};
486 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4}, {4}, {0, 1}, golden_data);
489 TEST(broadcast_gpu_float, bfyx_3_to_2x3x4_w_b_axes_0_2) {
490 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0,
491 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 3.0, 3.0, 3.0, 3.0};
492 start_broadcast_test<float>(data_types::f32, {2, 3, 4}, {3}, {0, 2}, golden_data);
495 TEST(broadcast_gpu_uint8_t, bfyx_3_to_2x3x4_w_b_axes_0_2) {
496 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,
497 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3};
498 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4}, {3}, {0, 2}, golden_data);
501 TEST(broadcast_gpu_float, bfyx_2_to_2x3x4_w_b_axes_1_2) {
502 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
503 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0};
504 start_broadcast_test<float>(data_types::f32, {2, 3, 4}, {2}, {1, 2}, golden_data);
507 TEST(broadcast_gpu_uint8_t, bfyx_2_to_2x3x4_w_b_axes_1_2) {
508 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
509 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
510 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4}, {2}, {1, 2}, golden_data);
513 TEST(broadcast_gpu_float, bfyx_3x4x5_to_2x3x4x5_w_b_axes_0) {
514 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
515 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0,
516 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0,
517 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0,
518 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0,
519 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0,
520 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0,
521 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0,
522 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0,
523 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0};
524 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {3, 4, 5}, {0}, golden_data);
527 TEST(broadcast_gpu_uint8_t, bfyx_3x4x5_to_2x3x4x5_w_b_axes_0) {
528 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
529 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
530 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
531 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
532 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
533 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
534 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
535 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
536 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48,
537 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60};
538 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {3, 4, 5}, {0}, golden_data);
541 TEST(broadcast_gpu_float, bfyx_2x4x5_to_2x3x4x5_w_b_axes_1) {
542 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
543 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
544 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
545 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
546 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
547 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
548 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
549 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0,
550 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
551 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0,
552 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0,
553 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0};
554 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {2, 4, 5}, {1}, golden_data);
557 TEST(broadcast_gpu_uint8_t, bfyx_2x4x5_to_2x3x4x5_w_b_axes_1) {
558 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
559 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
560 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
561 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
562 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
563 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
564 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
565 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
566 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
567 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
568 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
569 31, 32, 33, 34, 35, 36, 37, 38, 39, 40};
570 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {2, 4, 5}, {1}, golden_data);
573 TEST(broadcast_gpu_float, bfyx_2x3x5_to_2x3x4x5_w_b_axes_2) {
574 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
575 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
576 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
577 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
578 11.0, 12.0, 13.0, 14.0, 15.0, 11.0, 12.0, 13.0, 14.0, 15.0,
579 11.0, 12.0, 13.0, 14.0, 15.0, 11.0, 12.0, 13.0, 14.0, 15.0,
580 16.0, 17.0, 18.0, 19.0, 20.0, 16.0, 17.0, 18.0, 19.0, 20.0,
581 16.0, 17.0, 18.0, 19.0, 20.0, 16.0, 17.0, 18.0, 19.0, 20.0,
582 21.0, 22.0, 23.0, 24.0, 25.0, 21.0, 22.0, 23.0, 24.0, 25.0,
583 21.0, 22.0, 23.0, 24.0, 25.0, 21.0, 22.0, 23.0, 24.0, 25.0,
584 26.0, 27.0, 28.0, 29.0, 30.0, 26.0, 27.0, 28.0, 29.0, 30.0,
585 26.0, 27.0, 28.0, 29.0, 30.0, 26.0, 27.0, 28.0, 29.0, 30.0};
586 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {2, 3, 5}, {2}, golden_data);
589 TEST(broadcast_gpu_uint8_t, bfyx_2x3x5_to_2x3x4x5_w_b_axes_2) {
590 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
591 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
592 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
593 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
594 11, 12, 13, 14, 15, 11, 12, 13, 14, 15,
595 11, 12, 13, 14, 15, 11, 12, 13, 14, 15,
596 16, 17, 18, 19, 20, 16, 17, 18, 19, 20,
597 16, 17, 18, 19, 20, 16, 17, 18, 19, 20,
598 21, 22, 23, 24, 25, 21, 22, 23, 24, 25,
599 21, 22, 23, 24, 25, 21, 22, 23, 24, 25,
600 26, 27, 28, 29, 30, 26, 27, 28, 29, 30,
601 26, 27, 28, 29, 30, 26, 27, 28, 29, 30};
602 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {2, 3, 5}, {2}, golden_data);
605 TEST(broadcast_gpu_float, bfyx_2x3x4_to_2x3x4x5_w_b_axes_3) {
606 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
607 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
608 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0,
609 7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 8.0, 8.0,
610 9.0, 9.0, 9.0, 9.0, 9.0, 10.0, 10.0, 10.0, 10.0, 10.0,
611 11.0, 11.0, 11.0, 11.0, 11.0, 12.0, 12.0, 12.0, 12.0, 12.0,
612 13.0, 13.0, 13.0, 13.0, 13.0, 14.0, 14.0, 14.0, 14.0, 14.0,
613 15.0, 15.0, 15.0, 15.0, 15.0, 16.0, 16.0, 16.0, 16.0, 16.0,
614 17.0, 17.0, 17.0, 17.0, 17.0, 18.0, 18.0, 18.0, 18.0, 18.0,
615 19.0, 19.0, 19.0, 19.0, 19.0, 20.0, 20.0, 20.0, 20.0, 20.0,
616 21.0, 21.0, 21.0, 21.0, 21.0, 22.0, 22.0, 22.0, 22.0, 22.0,
617 23.0, 23.0, 23.0, 23.0, 23.0, 24.0, 24.0, 24.0, 24.0, 24.0};
618 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {2, 3, 4}, {3}, golden_data);
621 TEST(broadcast_gpu_uint8_t, bfyx_2x3x4_to_2x3x4x5_w_b_axes_3) {
622 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
623 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
624 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
625 7, 7, 7, 7, 7, 8, 8, 8, 8, 8,
626 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
627 11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
628 13, 13, 13, 13, 13, 14, 14, 14, 14, 14,
629 15, 15, 15, 15, 15, 16, 16, 16, 16, 16,
630 17, 17, 17, 17, 17, 18, 18, 18, 18, 18,
631 19, 19, 19, 19, 19, 20, 20, 20, 20, 20,
632 21, 21, 21, 21, 21, 22, 22, 22, 22, 22,
633 23, 23, 23, 23, 23, 24, 24, 24, 24, 24};
634 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {2, 3, 4}, {3}, golden_data);
637 TEST(broadcast_gpu_float, bfyx_4x5_to_2x3x4x5_w_b_axes_0_1) {
638 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
639 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
640 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
641 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
642 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
643 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
644 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
645 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
646 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
647 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0,
648 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
649 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0};
650 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {4, 5}, {0, 1}, golden_data);
653 TEST(broadcast_gpu_uint8_t, bfyx_4x5_to_2x3x4x5_w_b_axes_0_1) {
654 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
655 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
656 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
657 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
658 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
659 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
660 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
661 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
662 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
663 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
664 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
665 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
666 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {4, 5}, {0, 1}, golden_data);
669 TEST(broadcast_gpu_float, bfyx_3x5_to_2x3x4x5_w_b_axes_0_2) {
670 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
671 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
672 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
673 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
674 11.0, 12.0, 13.0, 14.0, 15.0, 11.0, 12.0, 13.0, 14.0, 15.0,
675 11.0, 12.0, 13.0, 14.0, 15.0, 11.0, 12.0, 13.0, 14.0, 15.0,
676 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
677 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
678 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
679 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
680 11.0, 12.0, 13.0, 14.0, 15.0, 11.0, 12.0, 13.0, 14.0, 15.0,
681 11.0, 12.0, 13.0, 14.0, 15.0, 11.0, 12.0, 13.0, 14.0, 15.0};
682 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {3, 5}, {0, 2}, golden_data);
685 TEST(broadcast_gpu_uint8_t, bfyx_3x5_to_2x3x4x5_w_b_axes_0_2) {
686 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
687 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
688 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
689 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
690 11, 12, 13, 14, 15, 11, 12, 13, 14, 15,
691 11, 12, 13, 14, 15, 11, 12, 13, 14, 15,
692 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
693 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
694 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
695 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
696 11, 12, 13, 14, 15, 11, 12, 13, 14, 15,
697 11, 12, 13, 14, 15, 11, 12, 13, 14, 15};
698 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {3, 5}, {0, 2}, golden_data);
701 TEST(broadcast_gpu_float, bfyx_3x4_to_2x3x4x5_w_b_axes_0_3) {
702 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
703 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
704 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0,
705 7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 8.0, 8.0,
706 9.0, 9.0, 9.0, 9.0, 9.0, 10.0, 10.0, 10.0, 10.0, 10.0,
707 11.0, 11.0, 11.0, 11.0, 11.0, 12.0, 12.0, 12.0, 12.0, 12.0,
708 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
709 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
710 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0,
711 7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 8.0, 8.0,
712 9.0, 9.0, 9.0, 9.0, 9.0, 10.0, 10.0, 10.0, 10.0, 10.0,
713 11.0, 11.0, 11.0, 11.0, 11.0, 12.0, 12.0, 12.0, 12.0, 12.0};
714 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {3, 4}, {0, 3}, golden_data);
717 TEST(broadcast_gpu_uint8_t, bfyx_3x4_to_2x3x4x5_w_b_axes_0_3) {
718 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
719 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
720 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
721 7, 7, 7, 7, 7, 8, 8, 8, 8, 8,
722 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
723 11, 11, 11, 11, 11, 12, 12, 12, 12, 12,
724 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
725 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
726 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
727 7, 7, 7, 7, 7, 8, 8, 8, 8, 8,
728 9, 9, 9, 9, 9, 10, 10, 10, 10, 10,
729 11, 11, 11, 11, 11, 12, 12, 12, 12, 12};
730 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {3, 4}, {0, 3}, golden_data);
733 TEST(broadcast_gpu_float, bfyx_2x5_to_2x3x4x5_w_b_axes_1_2) {
734 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
735 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
736 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
737 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
738 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
739 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
740 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
741 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
742 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
743 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
744 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0,
745 6.0, 7.0, 8.0, 9.0, 10.0, 6.0, 7.0, 8.0, 9.0, 10.0};
746 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {2, 5}, {1, 2}, golden_data);
749 TEST(broadcast_gpu_uint8_t, bfyx_2x5_to_2x3x4x5_w_b_axes_1_2) {
750 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
751 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
752 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
753 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
754 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
755 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
756 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
757 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
758 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
759 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
760 6, 7, 8, 9, 10, 6, 7, 8, 9, 10,
761 6, 7, 8, 9, 10, 6, 7, 8, 9, 10};
762 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {2, 5}, {1, 2}, golden_data);
765 TEST(broadcast_gpu_float, bfyx_2x4_to_2x3x4x5_w_b_axes_1_3) {
766 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
767 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
768 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
769 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
770 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
771 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
772 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0,
773 7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 8.0, 8.0,
774 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0,
775 7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 8.0, 8.0,
776 5.0, 5.0, 5.0, 5.0, 5.0, 6.0, 6.0, 6.0, 6.0, 6.0,
777 7.0, 7.0, 7.0, 7.0, 7.0, 8.0, 8.0, 8.0, 8.0, 8.0};
778 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {2, 4}, {1, 3}, golden_data);
781 TEST(broadcast_gpu_uint8_t, bfyx_2x4_to_2x3x4x5_w_b_axes_1_3) {
782 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
783 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
784 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
785 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
786 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
787 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
788 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
789 7, 7, 7, 7, 7, 8, 8, 8, 8, 8,
790 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
791 7, 7, 7, 7, 7, 8, 8, 8, 8, 8,
792 5, 5, 5, 5, 5, 6, 6, 6, 6, 6,
793 7, 7, 7, 7, 7, 8, 8, 8, 8, 8};
794 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {2, 4}, {1, 3}, golden_data);
797 TEST(broadcast_gpu_float, bfyx_2x3_to_2x3x4x5_w_b_axes_2_3) {
798 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
799 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
800 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
801 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
802 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0,
803 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0,
804 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0,
805 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0, 4.0,
806 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,
807 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0, 5.0,
808 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0,
809 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0};
810 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {2, 3}, {2, 3}, golden_data);
813 TEST(broadcast_gpu_uint8_t, bfyx_2x3_to_2x3x4x5_w_b_axes_2_3) {
814 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
815 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
816 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
817 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
818 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
819 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
820 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
821 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
822 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
823 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
824 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
825 6, 6, 6, 6, 6, 6, 6, 6, 6, 6};
826 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {2, 3}, {2, 3}, golden_data);
829 TEST(broadcast_gpu_float, bfyx_5_to_2x3x4x5_w_b_axes_0_1_2) {
830 std::vector<float> golden_data = {1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
831 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
832 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
833 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
834 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
835 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
836 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
837 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
838 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
839 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
840 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0,
841 1.0, 2.0, 3.0, 4.0, 5.0, 1.0, 2.0, 3.0, 4.0, 5.0};
842 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {5}, {0, 1, 2}, golden_data);
845 TEST(broadcast_gpu_uint8_t, bfyx_5_to_2x3x4x5_w_b_axes_0_1_2) {
846 std::vector<uint8_t> golden_data = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
847 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
848 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
849 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
850 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
851 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
852 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
853 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
854 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
855 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
856 1, 2, 3, 4, 5, 1, 2, 3, 4, 5,
857 1, 2, 3, 4, 5, 1, 2, 3, 4, 5};
858 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {5}, {0, 1, 2}, golden_data);
861 TEST(broadcast_gpu_float, bfyx_4_to_2x3x4x5_w_b_axes_0_1_3) {
862 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
863 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
864 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
865 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
866 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
867 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
868 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
869 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
870 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
871 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0,
872 1.0, 1.0, 1.0, 1.0, 1.0, 2.0, 2.0, 2.0, 2.0, 2.0,
873 3.0, 3.0, 3.0, 3.0, 3.0, 4.0, 4.0, 4.0, 4.0, 4.0};
874 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {4}, {0, 1, 3}, golden_data);
877 TEST(broadcast_gpu_uint8_t, bfyx_4_to_2x3x4x5_w_b_axes_0_1_3) {
878 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
879 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
880 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
881 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
882 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
883 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
884 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
885 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
886 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
887 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
888 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
889 3, 3, 3, 3, 3, 4, 4, 4, 4, 4};
890 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {4}, {0, 1, 3}, golden_data);
893 TEST(broadcast_gpu_float, bfyx_3_to_2x3x4x5_w_b_axes_0_2_3) {
894 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
895 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
896 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
897 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
898 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0,
899 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0,
900 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
901 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
902 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
903 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
904 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0,
905 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0, 3.0};
906 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {3}, {0, 2, 3}, golden_data);
909 TEST(broadcast_gpu_uint8_t, bfyx_3_to_2x3x4x5_w_b_axes_0_2_3) {
910 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
911 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
912 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
913 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
914 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
915 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
916 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
917 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
918 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
919 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
920 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
921 3, 3, 3, 3, 3, 3, 3, 3, 3, 3};
922 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {3}, {0, 2, 3}, golden_data);
925 TEST(broadcast_gpu_float, bfyx_2_to_2x3x4x5_w_b_axes_1_2_3) {
926 std::vector<float> golden_data = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
927 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
928 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
929 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
930 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
931 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
932 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
933 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
934 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
935 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
936 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
937 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0};
938 start_broadcast_test<float>(data_types::f32, {2, 3, 4, 5}, {2}, {1, 2, 3}, golden_data);
941 TEST(broadcast_gpu_uint8_t, bfyx_2_to_2x3x4x5_w_b_axes_1_2_3) {
942 std::vector<uint8_t> golden_data = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
943 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
944 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
945 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
946 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
947 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
948 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
949 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
950 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
951 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
952 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
953 2, 2, 2, 2, 2, 2, 2, 2, 2, 2};
954 start_broadcast_test<uint8_t>(data_types::u8, {2, 3, 4, 5}, {2}, {1, 2, 3}, golden_data);
958 TEST(broadcast_gpu, basic_error_wrong_b_axes_size) {
960 const auto& engine = get_test_engine();
961 auto input = memory::allocate(engine, {data_types::f32, format::bfyx, {1, 1, 1, 1}});
964 topology.add(input_layout("input", input.get_layout()));
965 topology.add(broadcast("output", "input", {2, 3, 4, 5}, {0, 1, 2, 3, 4}));
967 std::string msg_to_find = "Incorrect parameters configuration: broadcast_axes size should be less or equal 4.";
968 EXPECT_ANY_THROW(check_exception_massage(engine, topology, msg_to_find));
971 TEST(broadcast_gpu, basic_error_wrong_b_axis_value) {
973 const auto& engine = get_test_engine();
974 auto input = memory::allocate(engine, {data_types::f32, format::bfyx, {1, 1, 1, 1}});
977 topology.add(input_layout("input", input.get_layout()));
978 topology.add(broadcast("output", "input", {2, 3, 4, 5}, {0, 4}));
980 std::string msg_to_find = "Incorrect parameters configuration: broadcast_axes index should be within broadcast_sizes range.";
981 EXPECT_ANY_THROW(check_exception_massage(engine, topology, msg_to_find));
984 TEST(broadcast_gpu, basic_error_duplicate_b_axis_values) {
986 const auto& engine = get_test_engine();
987 auto input = memory::allocate(engine, {data_types::f32, format::bfyx, {1, 1, 1, 1}});
990 topology.add(input_layout("input", input.get_layout()));
991 topology.add(broadcast("output", "input", {2, 3, 4, 5}, {0, 1, 1}));
993 std::string msg_to_find = "Incorrect parameters configuration: Duplicate axes numbers was found in broadcast_axes.";
994 EXPECT_ANY_THROW(check_exception_massage(engine, topology, msg_to_find));
997 TEST(broadcast_gpu, basic_error_wrong_input_dimension_0) {
999 const auto& engine = get_test_engine();
1000 auto input = memory::allocate(engine, {data_types::f32, format::bfyx, {2, 3, 4, 5}});
1003 topology.add(input_layout("input", input.get_layout()));
1004 topology.add(broadcast("output", "input", {2, 3, 4, 5}, {1}));
1006 std::string msg_to_find = "Input size on dimension number 0(=2) is not equal to: (=1)";
1007 EXPECT_ANY_THROW(check_exception_massage(engine, topology, msg_to_find));
1010 TEST(broadcast_gpu, basic_error_not_dividable_2x3x4x5_to_3x3x4x5) {
1012 const auto& engine = get_test_engine();
1013 auto input = memory::allocate(engine, {data_types::f32, format::bfyx, {2, 3, 4, 5}});
1016 topology.add(input_layout("input", input.get_layout()));
1017 topology.add(broadcast("output", "input", {3, 3, 4, 5}, {}));
1019 std::string msg_to_find = "Invalid broadcast size: not dividable by input size";
1020 EXPECT_ANY_THROW(check_exception_massage(engine, topology, msg_to_find));
1023 TEST(broadcast_gpu, basic_error_not_dividable_3_to_2x3x4x5_w_b_axes_0x1x3) {
1025 const auto& engine = get_test_engine();
1026 auto input = memory::allocate(engine, {data_types::f32, format::bfyx, {1, 1, 3, 1}});
1029 topology.add(input_layout("input", input.get_layout()));
1030 topology.add(broadcast("output", "input", {2, 3, 4, 5}, {0, 1, 3}));
1032 std::string msg_to_find = "Invalid broadcast size: not dividable by input size";
1033 EXPECT_ANY_THROW(check_exception_massage(engine, topology, msg_to_find));
1036 TEST(broadcast_gpu, basic_error_not_dividable_4x5_to_3x4x5_w_b_axes_1) {
1038 const auto& engine = get_test_engine();
1039 auto input = memory::allocate(engine, {data_types::f32, format::bfyx, {1, 3, 5, 4}});
1042 topology.add(input_layout("input", input.get_layout()));
1043 topology.add(broadcast("output", "input", {2, 3, 4, 5}, {1}));
1045 std::string msg_to_find = "Invalid broadcast size: not dividable by input size";
1046 EXPECT_ANY_THROW(check_exception_massage(engine, topology, msg_to_find));