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