blob: e4e32d10d43e6b57323d39a6b11576cde525c9d7 [file] [log] [blame]
Marat Dukhan188d1042020-11-24 23:39:40 -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
Marat Dukhan0e521172020-11-25 13:10:04 -080011TEST(DEPTH_TO_SPACE_NCHW2NHWC_X32, one_pixel) {
12 DepthToSpaceOperatorTester()
13 .input_size(1, 1)
14 .block_size(3)
15 .output_channels(17)
16 .TestNCHW2NHWCxX32();
17}
18
Marat Dukhan188d1042020-11-24 23:39:40 -080019TEST(DEPTH_TO_SPACE_NCHW2NHWC_X32, one_column) {
20 for (size_t input_height = 1; input_height <= 7; input_height++) {
21 DepthToSpaceOperatorTester()
22 .input_size(input_height, 1)
23 .block_size(3)
24 .output_channels(17)
Marat Dukhan0e521172020-11-25 13:10:04 -080025 .TestNCHW2NHWCxX32();
Marat Dukhan188d1042020-11-24 23:39:40 -080026 }
27}
28
29TEST(DEPTH_TO_SPACE_NCHW2NHWC_X32, one_row) {
30 for (size_t input_width = 1; input_width <= 7; input_width++) {
31 DepthToSpaceOperatorTester()
32 .input_size(1, input_width)
33 .block_size(3)
34 .output_channels(17)
Marat Dukhan0e521172020-11-25 13:10:04 -080035 .TestNCHW2NHWCxX32();
Marat Dukhan188d1042020-11-24 23:39:40 -080036 }
37}
38
39TEST(DEPTH_TO_SPACE_NCHW2NHWC_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)
Marat Dukhan0e521172020-11-25 13:10:04 -080046 .TestNCHW2NHWCxX32();
Marat Dukhan188d1042020-11-24 23:39:40 -080047 }
48 }
49}
50
51TEST(DEPTH_TO_SPACE_NCHW2NHWC_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)
Marat Dukhan0e521172020-11-25 13:10:04 -080057 .TestNCHW2NHWCxX32();
Marat Dukhan188d1042020-11-24 23:39:40 -080058 }
59}
60
61TEST(DEPTH_TO_SPACE_NCHW2NHWC_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)
Marat Dukhan0e521172020-11-25 13:10:04 -080067 .TestNCHW2NHWCxX32();
Marat Dukhan188d1042020-11-24 23:39:40 -080068 }
69}
70
71TEST(DEPTH_TO_SPACE_NCHW2NHWC_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)
Marat Dukhan0e521172020-11-25 13:10:04 -080078 .TestNCHW2NHWCxX32();
Marat Dukhan188d1042020-11-24 23:39:40 -080079 }
80}
81
82TEST(DEPTH_TO_SPACE_NCHW2NHWC_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)
Marat Dukhan0e521172020-11-25 13:10:04 -080089 .TestNCHW2NHWCxX32();
Marat Dukhan188d1042020-11-24 23:39:40 -080090}
91
92TEST(DEPTH_TO_SPACE_NCHW2NHWC_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)
Marat Dukhan0e521172020-11-25 13:10:04 -080099 .TestNCHW2NHWCxX32();
Marat Dukhan188d1042020-11-24 23:39:40 -0800100}