blob: bdf86d918ac4b4c232e95f84293b147a4ca18a01 [file] [log] [blame]
Marat Dukhan0e521172020-11-25 13:10:04 -08001// Copyright 2020 Google LLC
2//
3// This source code is licensed under the BSD-style license found in the
4// LICENSE file in the root directory of this source tree.
5
6#include "depth-to-space-operator-tester.h"
7
8#include <gtest/gtest.h>
9
10
11TEST(DEPTH_TO_SPACE_NHWC_X32, one_pixel) {
12 DepthToSpaceOperatorTester()
13 .input_size(1, 1)
14 .block_size(3)
15 .output_channels(17)
16 .TestNHWCxX32();
17}
18
19TEST(DEPTH_TO_SPACE_NHWC_X32, one_column) {
20 for (size_t input_height = 2; input_height <= 7; input_height++) {
21 DepthToSpaceOperatorTester()
22 .input_size(input_height, 1)
23 .block_size(3)
24 .output_channels(17)
25 .TestNHWCxX32();
26 }
27}
28
29TEST(DEPTH_TO_SPACE_NHWC_X32, one_row) {
30 for (size_t input_width = 2; input_width <= 7; input_width++) {
31 DepthToSpaceOperatorTester()
32 .input_size(1, input_width)
33 .block_size(3)
34 .output_channels(17)
35 .TestNHWCxX32();
36 }
37}
38
39TEST(DEPTH_TO_SPACE_NHWC_X32, varying_input_size) {
40 for (size_t input_height = 1; input_height <= 5; input_height++) {
41 for (size_t input_width = 1; input_width <= 5; input_width++) {
42 DepthToSpaceOperatorTester()
43 .input_size(input_height, input_width)
44 .block_size(3)
45 .output_channels(17)
46 .TestNHWCxX32();
47 }
48 }
49}
50
51TEST(DEPTH_TO_SPACE_NHWC_X32, varying_block_size) {
52 for (uint32_t block_size = 2; block_size <= 5; block_size++) {
53 DepthToSpaceOperatorTester()
54 .input_size(7, 5)
55 .block_size(block_size)
56 .output_channels(17)
57 .TestNHWCxX32();
58 }
59}
60
61TEST(DEPTH_TO_SPACE_NHWC_X32, varying_output_channels) {
62 for (size_t output_channels = 1; output_channels <= 15; output_channels++) {
63 DepthToSpaceOperatorTester()
64 .input_size(7, 5)
65 .block_size(3)
66 .output_channels(output_channels)
67 .TestNHWCxX32();
68 }
69}
70
71TEST(DEPTH_TO_SPACE_NHWC_X32, varying_batch_size) {
72 for (size_t batch_size = 2; batch_size <= 3; batch_size++) {
73 DepthToSpaceOperatorTester()
74 .batch_size(batch_size)
75 .input_size(7, 5)
76 .block_size(3)
77 .output_channels(17)
78 .TestNHWCxX32();
79 }
80}
81
82TEST(DEPTH_TO_SPACE_NHWC_X32, input_channels_stride) {
83 DepthToSpaceOperatorTester()
84 .batch_size(2)
85 .input_size(7, 5)
86 .block_size(3)
87 .input_channels_stride(157)
88 .output_channels(17)
89 .TestNHWCxX32();
90}
91
92TEST(DEPTH_TO_SPACE_NHWC_X32, output_channels_stride) {
93 DepthToSpaceOperatorTester()
94 .batch_size(2)
95 .input_size(7, 5)
96 .block_size(3)
97 .output_channels_stride(19)
98 .output_channels(17)
99 .TestNHWCxX32();
100}