blob: f0d5a72417cdc627e80136a0806999bd924bc4e9 [file] [log] [blame]
Yury Kartynnike7841862020-11-04 18:22:18 -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 <gtest/gtest.h>
7
8#include <xnnpack/common.h>
9#include <xnnpack/isa-checks.h>
10
11#include <xnnpack/depthtospace.h>
Marat Dukhanad71b9a2020-11-20 00:01:51 -080012#include "depthtospace-microkernel-tester.h"
Yury Kartynnike7841862020-11-04 18:22:18 -080013
14
Marat Dukhanad71b9a2020-11-20 00:01:51 -080015TEST(X32_DEPTHTOSPACE_CHW2HWC__SCALAR, channels_eq_1) {
Yury Kartynnike7841862020-11-04 18:22:18 -080016 DepthToSpaceMicrokernelTester()
17 .output_channels(1)
Marat Dukhanad71b9a2020-11-20 00:01:51 -080018 .Test(xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar);
Yury Kartynnike7841862020-11-04 18:22:18 -080019}
20
Marat Dukhanad71b9a2020-11-20 00:01:51 -080021TEST(X32_DEPTHTOSPACE_CHW2HWC__SCALAR, channels_gt_1) {
Yury Kartynnike7841862020-11-04 18:22:18 -080022 for (size_t channels = 2; channels < 10; channels++) {
23 DepthToSpaceMicrokernelTester()
24 .output_channels(channels)
Marat Dukhanad71b9a2020-11-20 00:01:51 -080025 .Test(xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar);
Yury Kartynnike7841862020-11-04 18:22:18 -080026 }
27}
28
Marat Dukhanad71b9a2020-11-20 00:01:51 -080029TEST(X32_DEPTHTOSPACE_CHW2HWC__SCALAR, non_unit_size) {
Yury Kartynnike7841862020-11-04 18:22:18 -080030 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 Dukhanad71b9a2020-11-20 00:01:51 -080037 .Test(xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar);
Yury Kartynnike7841862020-11-04 18:22:18 -080038 }
39 }
40 }
41}
42
Marat Dukhanad71b9a2020-11-20 00:01:51 -080043TEST(X32_DEPTHTOSPACE_CHW2HWC__SCALAR, non_unit_size_block_size_3) {
Yury Kartynnike7841862020-11-04 18:22:18 -080044 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 Dukhanad71b9a2020-11-20 00:01:51 -080052 .Test(xnn_x32_depthtospace2d_chw2hwc_ukernel__scalar);
Yury Kartynnike7841862020-11-04 18:22:18 -080053 }
54 }
55 }
56}