Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 1 | // 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 <gtest/gtest.h> |
| 7 | |
| 8 | #include <xnnpack/common.h> |
| 9 | #include <xnnpack/isa-checks.h> |
| 10 | |
| 11 | #include <xnnpack/depthtospace.h> |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 12 | #include "depthtospace-microkernel-tester.h" |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 13 | |
| 14 | |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 15 | TEST(X32_DEPTHTOSPACE_CHW2HWC__SCALAR, channels_eq_1) { |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 16 | DepthToSpaceMicrokernelTester() |
| 17 | .output_channels(1) |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 18 | .Test(xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar); |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 19 | } |
| 20 | |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 21 | TEST(X32_DEPTHTOSPACE_CHW2HWC__SCALAR, channels_gt_1) { |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 22 | for (size_t channels = 2; channels < 10; channels++) { |
| 23 | DepthToSpaceMicrokernelTester() |
| 24 | .output_channels(channels) |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 25 | .Test(xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar); |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 26 | } |
| 27 | } |
| 28 | |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 29 | TEST(X32_DEPTHTOSPACE_CHW2HWC__SCALAR, non_unit_size) { |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 30 | for (size_t height = 2; height < 5; height++) { |
| 31 | for (size_t width = 2; width < 5; width++) { |
| 32 | for (size_t channels = 1; channels < 16; channels += 3) { |
| 33 | DepthToSpaceMicrokernelTester() |
| 34 | .output_channels(channels) |
| 35 | .input_height(height) |
| 36 | .input_width(width) |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 37 | .Test(xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar); |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 38 | } |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 | |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 43 | TEST(X32_DEPTHTOSPACE_CHW2HWC__SCALAR, non_unit_size_block_size_3) { |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 44 | for (size_t height = 2; height < 5; height++) { |
| 45 | for (size_t width = 2; width < 5; width++) { |
| 46 | for (size_t channels = 1; channels < 16; channels += 3) { |
| 47 | DepthToSpaceMicrokernelTester() |
| 48 | .output_channels(channels) |
| 49 | .input_height(height) |
| 50 | .input_width(width) |
| 51 | .block_size(3) |
Marat Dukhan | ad71b9a | 2020-11-20 00:01:51 -0800 | [diff] [blame] | 52 | .Test(xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar); |
Yury Kartynnik | e784186 | 2020-11-04 18:22:18 -0800 | [diff] [blame] | 53 | } |
| 54 | } |
| 55 | } |
| 56 | } |