2 // Copyright (c) 2016 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
17 ///////////////////////////////////////////////////////////////////////////////////////////////////
19 #include <gtest/gtest.h>
20 #include "api/CPP/memory.hpp"
21 #include <api/CPP/input_layout.hpp>
22 #include "api/CPP/deconvolution.hpp"
23 #include <api/CPP/data.hpp>
24 #include <api/CPP/topology.hpp>
25 #include <api/CPP/network.hpp>
26 #include <api/CPP/engine.hpp>
27 #include "test_utils/test_utils.h"
28 #include "test_utils/float16.h"
29 #include "api/CPP/reorder.hpp"
32 using namespace cldnn;
33 using namespace tests;
35 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_nopad) {
56 const auto& engine = get_test_engine();
58 auto input = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
59 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
60 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 1, 1 } });
62 set_values(input, { 8.f, 0.5f, 6.f, 9.f });
63 set_values(weights, { -2.0f, 0.5f, 3.5f, 1.5f });
64 set_values(biases, { 2.0f });
67 input_layout("input", input.get_layout()),
68 data("weights", weights),
69 data("biases", biases),
70 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,1,1 })
73 network network(engine, topology);
74 network.set_input_data("input", input);
76 auto outputs = network.execute();
77 EXPECT_EQ(outputs.size(), size_t(1));
78 EXPECT_EQ(outputs.begin()->first, "deconv");
80 auto output_prim = outputs.begin()->second.get_memory();
82 auto output_ptr = output_prim.pointer<float>();
84 std::vector<float> expected_output_vec = {
90 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
92 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
97 TEST(deconvolution_f32_fw_gpu, no_bias_basic_wsiz2x2_in2x2x1x1_nopad) {
118 const auto& engine = get_test_engine();
120 auto input = memory::allocate(engine, { data_types::f32, format::yxfb,{ 1, 1, 2, 2 } });
121 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb,{ 1, 1, 2, 2 } });
123 set_values(input, { 8.f, 0.5f, 6.f, 9.f });
124 set_values(weights, { -2.0f, 0.5f, 3.5f, 1.5f });
127 input_layout("input", input.get_layout()),
128 data("weights", weights),
129 deconvolution("deconv", "input", { "weights" })
132 network network(engine, topology);
133 network.set_input_data("input", input);
135 auto outputs = network.execute();
136 EXPECT_EQ(outputs.size(), size_t(1));
137 EXPECT_EQ(outputs.begin()->first, "deconv");
139 auto output_prim = outputs.begin()->second.get_memory();
141 auto output_ptr = output_prim.pointer<float>();
143 std::vector<float> expected_output_vec = {
149 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
151 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
156 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_nopad_bfyx) { // Filter : 2x2
176 const auto& engine = get_test_engine();
178 auto input = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
179 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 2, 2 } });
180 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 1, 1 } });
182 set_values(input, { 8.f, 0.5f, 6.f, 9.f });
183 set_values(weights, { -2.0f, 0.5f, 3.5f, 1.5f });
184 set_values(biases, { 2.0f });
187 input_layout("input", input.get_layout()),
188 data("weights", weights),
189 data("biases", biases),
190 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,1,1 })
193 network network(engine, topology);
194 network.set_input_data("input", input);
196 auto outputs = network.execute();
197 EXPECT_EQ(outputs.size(), size_t(1));
198 EXPECT_EQ(outputs.begin()->first, "deconv");
200 auto output_prim = outputs.begin()->second.get_memory();
202 auto output_ptr = output_prim.pointer<float>();
204 std::vector<float> expected_output_vec = {
210 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
212 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
216 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_pad1) {
236 const auto& engine = get_test_engine();
238 auto input = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
239 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
240 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 1, 1 } });
242 set_values(input, { 8.f, 0.5f, 6.f, 9.f });
243 set_values(weights, { -2.0f, 0.5f, 3.5f, 1.5f });
244 set_values(biases, { 2.0f });
247 input_layout("input", input.get_layout()),
248 data("weights", weights),
249 data("biases", biases),
250 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 1, 1 }, { 0, 0, -1, -1 })
253 network network(engine, topology);
254 network.set_input_data("input", input);
256 auto outputs = network.execute();
257 EXPECT_EQ(outputs.size(), size_t(1));
258 EXPECT_EQ(outputs.begin()->first, "deconv");
260 auto output_prim = outputs.begin()->second.get_memory();
262 auto output_ptr = output_prim.pointer<float>();
264 EXPECT_FLOAT_EQ(0.75f, output_ptr[0]);
267 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_stride2_nopad) {
287 const auto& engine = get_test_engine();
289 auto input = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
290 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
291 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 1, 1 } });
293 set_values(input, { 8.f, 0.5f, 6.f, 9.f });
294 set_values(weights, { -2.0f, 0.5f, 3.5f, 1.5f });
295 set_values(biases, { 1.0f });
298 input_layout("input", input.get_layout()),
299 data("weights", weights),
300 data("biases", biases),
301 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1,1,2,2 })
304 network network(engine, topology);
305 network.set_input_data("input", input);
307 auto outputs = network.execute();
308 EXPECT_EQ(outputs.size(), size_t(1));
309 EXPECT_EQ(outputs.begin()->first, "deconv");
311 auto output_prim = outputs.begin()->second.get_memory();
313 auto output_ptr = output_prim.pointer<float>();
315 std::vector<float> expected_output_vec = {
316 -15.f, 5.f, 0.f, 1.25f,
317 29.f, 13.f, 2.75f, 1.75,
318 -11.f, 4.f, -17.f, 5.5f,
319 22.f, 10.f, 32.5f, 14.5f
322 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
324 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
328 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x1_stride4_pad2) {
352 const auto& engine = get_test_engine();
354 auto input = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
355 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 3, 3 } });
356 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 1, 1 } });
358 set_values(input, { 8.f, 0.5f, 6.f, 9.f });
359 set_values(weights, { -2.0f, 0.5f, 1.f, 3.5f, 1.5f, 2.f, 3.f, 4.f, 5.f });
360 set_values(biases, { 0.0f });
363 input_layout("input", input.get_layout()),
364 data("weights", weights),
365 data("biases", biases),
366 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 4, 4 }, { 0, 0, -2, -2 })
369 network network(engine, topology);
370 network.set_input_data("input", input);
372 auto outputs = network.execute();
373 EXPECT_EQ(outputs.size(), size_t(1));
374 EXPECT_EQ(outputs.begin()->first, "deconv");
376 auto output_prim = outputs.begin()->second.get_memory();
378 auto output_ptr = output_prim.pointer<float>();
380 std::vector<float> expected_output_vec = {
386 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
388 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
392 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_stride2_pad1) {
414 const auto& engine = get_test_engine();
416 auto input = memory::allocate(engine, { data_types::f32, format::yxfb, { 2, 1, 2, 2 } });
417 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
418 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 1, 1 } });
420 set_values(input, { 8.f, 1.f, 0.5f, 3.f, 6.f, 2.f, 9.f, 4.f });
421 set_values(weights, { -2.f, 2.f, 7.f, -0.5f });
422 set_values(biases, { 1.0f });
425 input_layout("input", input.get_layout()),
426 data("weights", weights),
427 data("biases", biases),
428 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
431 network network(engine, topology);
432 network.set_input_data("input", input);
434 auto outputs = network.execute();
435 EXPECT_EQ(outputs.size(), size_t(1));
436 EXPECT_EQ(outputs.begin()->first, "deconv");
438 auto output_prim = outputs.begin()->second.get_memory();
440 auto output_ptr = output_prim.pointer<float>();
442 std::vector<float> expected_output_vec = {
443 -3.f, 0.5f, 4.5f, 22.f,
444 13.f, 5.f, -17.f, -7.f
447 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
449 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
453 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2x2_in2x2x1x1_stride2_pad1) {
479 const auto& engine = get_test_engine();
481 auto input = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
482 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb, { 2, 1, 2, 2 } });
483 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 2, 1 } });
485 set_values(input, { 8.f, 0.5f, 6.f, 9.f });
486 set_values(weights, { -2.f, -2.f, 2.f, 2.f, 7.f, 7.f, -0.5f, -0.5f });
487 set_values(biases, { 1.0f, 5.0f });
490 input_layout("input", input.get_layout()),
491 data("weights", weights),
492 data("biases", biases),
493 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
496 network network(engine, topology);
497 network.set_input_data("input", input);
499 auto outputs = network.execute();
500 EXPECT_EQ(outputs.size(), size_t(1));
501 EXPECT_EQ(outputs.begin()->first, "deconv");
503 auto output_prim = outputs.begin()->second.get_memory();
505 auto output_ptr = output_prim.pointer<float>();
507 std::vector<float> expected_output_vec = {
508 -3.f, 1.f, 4.5f, 8.5f,
509 13.f, 17.f, -17.f, -13.f
512 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
514 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
518 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_bfyx_stride2_pad1) {
540 const auto& engine = get_test_engine();
542 auto input = memory::allocate(engine, { data_types::f32, format::bfyx, { 2, 1, 2, 2 } });
543 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 2, 2 } });
544 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 1, 1 } });
546 set_values(input, { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f });
547 set_values(weights, { -2.f, 2.f, 7.f, -0.5f });
548 set_values(biases, { 1.0f });
551 input_layout("input", input.get_layout()),
552 data("weights", weights),
553 data("biases", biases),
554 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
557 network network(engine, topology);
558 network.set_input_data("input", input);
560 auto outputs = network.execute();
561 EXPECT_EQ(outputs.size(), size_t(1));
562 EXPECT_EQ(outputs.begin()->first, "deconv");
564 auto output_prim = outputs.begin()->second.get_memory();
566 auto output_ptr = output_prim.pointer<float>();
568 std::vector<float> expected_output_vec = {
569 -3.f, 4.5f, 13.f, -17.f,
573 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
575 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
579 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_bfyx_stride2_pad1_input_padding) {
585 // Input Padding : 2x1 (with reorder)
602 const auto& engine = get_test_engine();
604 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 2, 1, 2, 2 } });
605 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 2 } });
606 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 1, 1 } });
608 set_values(input, { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f });
609 set_values(weights, { -2.f, 2.f, 7.f, -0.5f });
610 set_values(biases, { 1.0f });
613 input_layout("input", input.get_layout()),
614 reorder("reorder", "input", input.get_layout().with_padding({ { 0, 0, 1, 2 }, 0 })),
615 data("weights", weights),
616 data("biases", biases),
617 deconvolution("deconv", "reorder", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
620 network network(engine, topology);
621 network.set_input_data("input", input);
623 auto outputs = network.execute();
624 EXPECT_EQ(outputs.size(), size_t(1));
625 EXPECT_EQ(outputs.begin()->first, "deconv");
627 auto output_prim = outputs.begin()->second.get_memory();
629 auto output_ptr = output_prim.pointer<float>();
631 std::vector<float> expected_output_vec = {
632 -3.f, 4.5f, 13.f, -17.f,
636 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
638 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
642 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2x2_in2x2x1x1_stride2_pad1_input_padding) {
648 // Input Padding : 2x1 (with reorder)
669 const auto& engine = get_test_engine();
671 auto input = memory::allocate(engine, { data_types::f32, format::yxfb,{ 1, 1, 2, 2 } });
672 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb,{ 2, 1, 2, 2 } });
673 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 1 } });
675 set_values(input, { 8.f, 0.5f, 6.f, 9.f });
676 set_values(weights, { -2.f, -2.f, 2.f, 2.f, 7.f, 7.f, -0.5f, -0.5f });
677 set_values(biases, { 1.0f, 5.0f });
680 input_layout("input", input.get_layout()),
681 reorder("reorder", "input", input.get_layout().with_padding({ { 0, 0, 1, 2 }, 0 })),
682 data("weights", weights),
683 data("biases", biases),
684 deconvolution("deconv", "reorder", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
687 network network(engine, topology);
688 network.set_input_data("input", input);
690 auto outputs = network.execute();
691 EXPECT_EQ(outputs.size(), size_t(1));
692 EXPECT_EQ(outputs.begin()->first, "deconv");
694 auto output_prim = outputs.begin()->second.get_memory();
696 auto output_ptr = output_prim.pointer<float>();
698 std::vector<float> expected_output_vec = {
699 -3.f, 1.f, 4.5f, 8.5f,
700 13.f, 17.f, -17.f, -13.f
703 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
705 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
709 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in2x2x1x2_bfyx_yxfb_stride2_pad1) {
731 const auto& engine = get_test_engine();
733 auto input = memory::allocate(engine, { data_types::f32, format::bfyx, { 2, 1, 2, 2 } });
734 auto weights = memory::allocate(engine, { data_types::f32, format::yxfb, { 1, 1, 2, 2 } });
735 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx, { 1, 1, 1, 1 } });
737 set_values(input, { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f });
738 set_values(weights, { -2.f, 2.f, 7.f, -0.5f });
739 set_values(biases, { 1.0f });
742 input_layout("input", input.get_layout()),
743 data("weights", weights),
744 data("biases", biases),
745 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
748 network network(engine, topology);
749 network.set_input_data("input", input);
751 auto outputs = network.execute();
752 EXPECT_EQ(outputs.size(), size_t(1));
753 EXPECT_EQ(outputs.begin()->first, "deconv");
755 auto output_prim = outputs.begin()->second.get_memory();
757 auto output_ptr = output_prim.pointer<float>();
759 std::vector<float> expected_output_vec = {
760 -3.f, 4.5f, 13.f, -17.f,
764 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
766 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
770 TEST(deconvolution_f16_fw_gpu, basic_wsiz2x2_in2x2x1x2_bfyx_yxfb_stride2_pad1) {
792 const auto& engine = get_test_engine();
794 auto input = memory::allocate(engine, { data_types::f16, format::bfyx,{ 2, 1, 2, 2 } });
795 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 2 } });
796 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 1, 1 } });
798 cldnn::build_options options;
799 options.set_option(cldnn::build_option::optimize_data(true));
801 set_values(input, { FLOAT16(8.f), FLOAT16(0.5f), FLOAT16(6.f), FLOAT16(9.f),
802 FLOAT16(1.f), FLOAT16(3.f), FLOAT16(2.f), FLOAT16(4.f) });
803 set_values(weights, { -2.f, 2.f, 7.f, -0.5f});
804 set_values(biases, { 1.0f });
807 input_layout("input", input.get_layout()),
808 data("weights", weights),
809 data("biases", biases),
810 deconvolution("deconv", "input", { "weights" }, { "biases" }, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
813 network network(engine, topology, options);
814 network.set_input_data("input", input);
816 auto outputs = network.execute();
817 EXPECT_EQ(outputs.size(), size_t(1));
818 EXPECT_EQ(outputs.begin()->first, "deconv");
820 auto output_prim = outputs.begin()->second.get_memory();
822 auto output_ptr = output_prim.pointer<uint16_t>();
824 std::vector<float> expected_output_vec = {
825 -3.f, 4.5f, 13.f, -17.f,
829 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
831 EXPECT_FLOAT_EQ(expected_output_vec[i], float16_to_float32(output_ptr[i]));
835 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2) {
864 const auto& engine = get_test_engine();
866 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 2, 2, 2 } });
867 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 2 } });
868 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 1, 1 } });
869 auto weights2 = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 2 } });
870 auto biases2 = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 1, 1 } });
872 set_values(input, { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f });
873 set_values(weights, { -2.f, 2.f, 7.f, -0.5f });
874 set_values(biases, { 1.0f });
875 set_values(weights2, { -4.f, 1.f, -9.f, -7.f });
876 set_values(biases2, { -1.0f });
879 input_layout("input", input.get_layout()),
880 data("weights", weights),
881 data("biases", biases),
882 data("weights2", weights2),
883 data("biases2", biases2),
884 deconvolution("deconv", "input", { "weights", "weights2" }, { "biases", "biases2" }, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
887 network network(engine, topology);
888 network.set_input_data("input", input);
890 auto outputs = network.execute();
891 EXPECT_EQ(outputs.size(), size_t(1));
892 EXPECT_EQ(outputs.begin()->first, "deconv");
894 auto output_prim = outputs.begin()->second.get_memory();
896 auto output_ptr = output_prim.pointer<float>();
898 std::vector<float> expected_output_vec = {
899 -3.f, 4.5f, 13.f, -17.f,
900 -8.f, -28.f, 1.f, -17.f
903 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
905 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
909 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_group2) {
910 // data is similar as in basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2
914 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 2, 2, 2 } });
915 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 2, 1, 2, 2 } });
916 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 1 } });
918 set_values(input, { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f });
919 set_values(weights, {
920 -2.f, 2.f, 7.f, -0.5f,
921 -4.f, 1.f, -9.f, -7.f
923 set_values(biases, { 1.0f, -1.0f });
926 input_layout("input", input.get_layout()),
927 data("weights", weights),
928 data("biases", biases),
929 deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 2, 2 }, { 0, 0, -1, -1 })
932 network network(engine, topology);
933 network.set_input_data("input", input);
935 auto outputs = network.execute();
936 EXPECT_EQ(outputs.size(), size_t(1));
937 EXPECT_EQ(outputs.begin()->first, "deconv");
939 auto output_prim = outputs.begin()->second.get_memory();
941 auto output_ptr = output_prim.pointer<float>();
943 std::vector<float> expected_output_vec = {
944 -3.f, 4.5f, 13.f, -17.f,
945 -8.f, -28.f, 1.f, -17.f
948 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
950 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
954 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2_depthwise_sep_opt) {
955 // Test for depthwise separable optimization, there are 16 weights and biases (split 16)
956 // data is similar as in basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2
958 const auto& engine = get_test_engine();
960 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 16, 2, 2 } });
962 { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
963 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
964 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
965 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
966 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
967 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
968 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
969 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f
972 topology topology(input_layout("input", input.get_layout()));
974 std::vector<primitive_id> weights_vec;
975 std::vector<primitive_id> bias_vec;
977 for (uint32_t i = 0; i < 8; i++)
979 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 2 } });
980 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 1, 1 } });
981 auto weights2 = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 2 } });
982 auto biases2 = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 1, 1 } });
984 set_values(weights, { -2.f, 2.f, 7.f, -0.5f });
985 set_values(biases, { 1.0f });
986 set_values(weights2, { -4.f, 1.f, -9.f, -7.f });
987 set_values(biases2, { -1.0f });
989 primitive_id weights_id = "weights_" + std::to_string(i);
990 primitive_id weights2_id = "weights2_" + std::to_string(i);
991 primitive_id bias_id = "biases_" + std::to_string(i);
992 primitive_id bias2_id = "biases2_" + std::to_string(i);
994 weights_vec.push_back(weights_id);
995 weights_vec.push_back(weights2_id);
996 bias_vec.push_back(bias_id);
997 bias_vec.push_back(bias2_id);
1000 data(weights_id, weights),
1001 data(bias_id, biases),
1002 data(weights2_id, weights2),
1003 data(bias2_id, biases2)
1007 topology.add(deconvolution("deconv", "input", weights_vec, bias_vec, { 1, 1, 2, 2 }, { 0, 0, -1, -1 }));
1009 network network(engine, topology);
1010 network.set_input_data("input", input);
1012 auto outputs = network.execute();
1013 EXPECT_EQ(outputs.size(), size_t(1));
1014 EXPECT_EQ(outputs.begin()->first, "deconv");
1016 auto output_prim = outputs.begin()->second.get_memory();
1018 auto output_ptr = output_prim.pointer<float>();
1020 std::vector<float> expected_output_vec = {
1021 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1022 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1023 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1024 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1025 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1026 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1027 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1028 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1031 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
1033 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
1037 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_group16) {
1038 // Test for depthwise separable optimization, there are 16 joined weights and biases (group 16)
1039 // data is similar as in basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2_depthwise_sep_opt
1043 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 16, 2, 2 } });
1045 { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1046 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1047 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1048 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1049 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1050 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1051 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1052 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f
1055 topology topology(input_layout("input", input.get_layout()));
1057 std::vector<primitive_id> weights_vec;
1058 std::vector<primitive_id> bias_vec;
1060 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 16, 1, 2, 2 } });
1061 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 16, 1 } });
1065 -2.f, 2.f, 7.f, -0.5f,
1066 -4.f, 1.f, -9.f, -7.f,
1067 -2.f, 2.f, 7.f, -0.5f,
1068 -4.f, 1.f, -9.f, -7.f,
1069 -2.f, 2.f, 7.f, -0.5f,
1070 -4.f, 1.f, -9.f, -7.f,
1071 -2.f, 2.f, 7.f, -0.5f,
1072 -4.f, 1.f, -9.f, -7.f,
1073 -2.f, 2.f, 7.f, -0.5f,
1074 -4.f, 1.f, -9.f, -7.f,
1075 -2.f, 2.f, 7.f, -0.5f,
1076 -4.f, 1.f, -9.f, -7.f,
1077 -2.f, 2.f, 7.f, -0.5f,
1078 -4.f, 1.f, -9.f, -7.f,
1079 -2.f, 2.f, 7.f, -0.5f,
1080 -4.f, 1.f, -9.f, -7.f
1083 set_values(biases, { 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f });
1085 data("weights", weights),
1086 data("bias", biases)
1089 topology.add(deconvolution("deconv", "input", { "weights" }, { "bias" }, 16, { 1, 1, 2, 2 }, { 0, 0, -1, -1 }));
1091 network network(engine, topology);
1092 network.set_input_data("input", input);
1094 auto outputs = network.execute();
1095 EXPECT_EQ(outputs.size(), size_t(1));
1096 EXPECT_EQ(outputs.begin()->first, "deconv");
1098 auto output_prim = outputs.begin()->second.get_memory();
1100 auto output_ptr = output_prim.pointer<float>();
1102 std::vector<float> expected_output_vec = {
1103 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1104 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1105 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1106 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1107 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1108 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1109 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1110 -3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1113 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
1115 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
1119 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2_depthwise_sep_opt_ofm2) {
1120 // Test for depthwise separable optimization, there are 16 weights and biases (split 16)
1121 // data is similar as in basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2
1123 const auto& engine = get_test_engine();
1125 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 16, 2, 2 } });
1127 { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1128 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1129 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1130 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1131 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1132 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1133 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1134 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f
1137 topology topology(input_layout("input", input.get_layout()));
1139 std::vector<primitive_id> weights_vec;
1140 std::vector<primitive_id> bias_vec;
1142 for (uint32_t i = 0; i < 8; i++)
1144 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 2, 1, 2, 2 } });
1145 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 1 } });
1146 auto weights2 = memory::allocate(engine, { data_types::f32, format::bfyx,{ 2, 1, 2, 2 } });
1147 auto biases2 = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 2, 1 } });
1149 set_values(weights, { -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f });
1150 set_values(biases, { 1.0f, 1.0f });
1151 set_values(weights2, { -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f });
1152 set_values(biases2, { -1.0f, -1.0f });
1154 primitive_id weights_id = "weights_" + std::to_string(i);
1155 primitive_id weights2_id = "weights2_" + std::to_string(i);
1156 primitive_id bias_id = "biases_" + std::to_string(i);
1157 primitive_id bias2_id = "biases2_" + std::to_string(i);
1159 weights_vec.push_back(weights_id);
1160 weights_vec.push_back(weights2_id);
1161 bias_vec.push_back(bias_id);
1162 bias_vec.push_back(bias2_id);
1165 data(weights_id, weights),
1166 data(bias_id, biases),
1167 data(weights2_id, weights2),
1168 data(bias2_id, biases2)
1172 topology.add(deconvolution("deconv", "input", weights_vec, bias_vec, { 1, 1, 2, 2 }, { 0, 0, -1, -1 }));
1174 network network(engine, topology);
1175 network.set_input_data("input", input);
1177 auto outputs = network.execute();
1178 EXPECT_EQ(outputs.size(), size_t(1));
1179 EXPECT_EQ(outputs.begin()->first, "deconv");
1181 auto output_prim = outputs.begin()->second.get_memory();
1183 auto output_ptr = output_prim.pointer<float>();
1185 std::vector<float> expected_output_vec = {
1186 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1187 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1188 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1189 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1190 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1191 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1192 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1193 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1196 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
1198 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
1202 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_group16_ofm2) {
1203 // Test for depthwise separable optimization, there are 16 joined weights and biases (group 16)
1204 // data is similar as in basic_wsiz2x2_in1x2x2x2_bfyx_stride2_pad1_split2_depthwise_sep_opt_ofm2
1208 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 16, 2, 2 } });
1210 { 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1211 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1212 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1213 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1214 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1215 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1216 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f,
1217 8.f, 0.5f, 6.f, 9.f, 1.f, 3.f, 2.f, 4.f
1220 topology topology(input_layout("input", input.get_layout()));
1222 std::vector<primitive_id> weights_vec;
1223 std::vector<primitive_id> bias_vec;
1225 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 32, 1, 2, 2 } });
1226 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 32, 1 } });
1230 -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f,
1231 -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f,
1232 -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f,
1233 -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f,
1234 -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f,
1235 -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f,
1236 -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f,
1237 -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f,
1238 -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f,
1239 -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f,
1240 -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f,
1241 -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f,
1242 -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f,
1243 -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f,
1244 -2.f, 2.f, 7.f, -0.5f, -2.f, 2.f, 7.f, -0.5f,
1245 -4.f, 1.f, -9.f, -7.f, -4.f, 1.f, -9.f, -7.f,
1251 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f,
1252 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f
1257 data("weights", weights),
1258 data("bias", biases)
1261 topology.add(deconvolution("deconv", "input", { "weights" }, { "bias" }, 16, { 1, 1, 2, 2 }, { 0, 0, -1, -1 }));
1263 network network(engine, topology);
1264 network.set_input_data("input", input);
1266 auto outputs = network.execute();
1267 EXPECT_EQ(outputs.size(), size_t(1));
1268 EXPECT_EQ(outputs.begin()->first, "deconv");
1270 auto output_prim = outputs.begin()->second.get_memory();
1272 auto output_ptr = output_prim.pointer<float>();
1274 std::vector<float> expected_output_vec = {
1275 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1276 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1277 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1278 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1279 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1280 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1281 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1282 -3.f, 4.5f, 13.f, -17.f,-3.f, 4.5f, 13.f, -17.f, -8.f, -28.f, 1.f, -17.f, -8.f, -28.f, 1.f, -17.f,
1285 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
1287 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
1292 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x6x1x1_bfyx_stride2_pad1_split2_ofm3) {
1329 const auto& engine = get_test_engine();
1331 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 4, 1, 1 } });
1332 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 3, 2, 1, 1 } });
1333 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 3, 1 } });
1334 auto weights2 = memory::allocate(engine, { data_types::f32, format::bfyx,{ 3, 2, 1, 1 } });
1335 auto biases2 = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 3, 1 } });
1338 1.5f, 0.5f, 2.0f, -1.0f
1340 set_values(weights, { -2.0f, 1.0f, 1.0f, 3.0f, 0.5f, 8.0f });
1341 set_values(biases, { 1.0f, 5.0f, 3.0f });
1342 set_values(weights2, { 4.0f, -4.0f, 2.0f, 0.5f, -0.5f, 3.0f });
1343 set_values(biases2, { -1.0f, 2.5f, 2.0f });
1346 input_layout("input", input.get_layout()),
1347 data("weights", weights),
1348 data("biases", biases),
1349 data("weights2", weights2),
1350 data("biases2", biases2),
1351 deconvolution("deconv", "input", { "weights", "weights2" }, { "biases", "biases2" }, { 1, 1, 1, 1 }, { 0, 0, 0, 0 })
1354 network network(engine, topology);
1355 network.set_input_data("input", input);
1357 auto outputs = network.execute();
1358 EXPECT_EQ(outputs.size(), size_t(1));
1359 EXPECT_EQ(outputs.begin()->first, "deconv");
1361 auto output_prim = outputs.begin()->second.get_memory();
1363 auto output_ptr = output_prim.pointer<float>();
1365 std::vector<float> expected_output_vec = {
1366 -1.5f, 8.0f, 7.75f, 11.0f, 6.0f, -2.0f
1368 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
1370 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);
1374 TEST(deconvolution_f32_fw_gpu, basic_wsiz2x2_in1x6x1x1_bfyx_stride2_pad1_group2_ofm3) {
1375 // data is similar as in basic_wsiz2x2_in1x6x1x1_bfyx_stride2_pad1_split2_ofm3
1379 auto input = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 4, 1, 1 } });
1380 auto weights = memory::allocate(engine, { data_types::f32, format::bfyx,{ 6, 2, 1, 1 } });
1381 auto biases = memory::allocate(engine, { data_types::f32, format::bfyx,{ 1, 1, 6, 1 } });
1384 1.5f, 0.5f, 2.0f, -1.0f
1386 set_values(weights, {
1387 -2.0f, 1.0f, 1.0f, 3.0f, 0.5f, 8.0f,
1388 4.0f, -4.0f, 2.0f, 0.5f, -0.5f, 3.0f
1390 set_values(biases, {
1396 input_layout("input", input.get_layout()),
1397 data("weights", weights),
1398 data("biases", biases),
1399 deconvolution("deconv", "input", { "weights" }, { "biases" }, 2, { 1, 1, 1, 1 }, { 0, 0, 0, 0 })
1402 network network(engine, topology);
1403 network.set_input_data("input", input);
1405 auto outputs = network.execute();
1406 EXPECT_EQ(outputs.size(), size_t(1));
1407 EXPECT_EQ(outputs.begin()->first, "deconv");
1409 auto output_prim = outputs.begin()->second.get_memory();
1411 auto output_ptr = output_prim.pointer<float>();
1413 std::vector<float> expected_output_vec = {
1414 -1.5f, 8.0f, 7.75f, 11.0f, 6.0f, -2.0f
1416 for (unsigned int i = 0; i < expected_output_vec.size(); i++)
1418 EXPECT_FLOAT_EQ(expected_output_vec[i], output_ptr[i]);