blob: b2667448080a7ee9bc0fc4394078b4b173cd0f2b [file] [log] [blame] [edit]
// Copyright 2022 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 "space-to-depth-operator-tester.h"
#include <gtest/gtest.h>
TEST(SPACE_TO_DEPTH_NHWC_X8, one_output_pixel) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.input_size(block_size, block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX8();
}
TEST(SPACE_TO_DEPTH_NHWC_X8, one_column) {
size_t block_size = 3;
for (size_t input_height = 2; input_height <= 7; input_height++) {
SpaceToDepthOperatorTester()
.input_size(input_height * block_size, block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX8();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X8, one_row) {
size_t block_size = 3;
for (size_t input_width = 2; input_width <= 7; input_width++) {
SpaceToDepthOperatorTester()
.input_size(block_size, input_width * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX8();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X8, varying_input_size) {
size_t block_size = 3;
for (size_t input_height = 1; input_height <= 5; input_height++) {
for (size_t input_width = 1; input_width <= 5; input_width++) {
SpaceToDepthOperatorTester()
.input_size(input_height * block_size, input_width * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX8();
}
}
}
TEST(SPACE_TO_DEPTH_NHWC_X8, varying_block_size) {
for (uint32_t block_size = 2; block_size <= 5; block_size++) {
SpaceToDepthOperatorTester()
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX8();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X8, varying_input_channels) {
size_t block_size = 3;
for (size_t input_channels = 1; input_channels <= 15; input_channels++) {
SpaceToDepthOperatorTester()
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(input_channels)
.TestNHWCxX8();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X8, varying_batch_size) {
size_t block_size = 3;
for (size_t batch_size = 2; batch_size <= 3; batch_size++) {
SpaceToDepthOperatorTester()
.batch_size(batch_size)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX8();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X8, input_channels_stride) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.batch_size(1)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels_stride(10)
.input_channels(9)
.TestNHWCxX8();
}
TEST(SPACE_TO_DEPTH_NHWC_X8, output_channels_stride) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.batch_size(2)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.output_channels_stride(171)
.input_channels(17)
.TestNHWCxX8();
}
TEST(SPACE_TO_DEPTH_NHWC_X16, one_output_pixel) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.input_size(block_size, block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX16();
}
TEST(SPACE_TO_DEPTH_NHWC_X16, one_column) {
size_t block_size = 3;
for (size_t input_height = 2; input_height <= 7; input_height++) {
SpaceToDepthOperatorTester()
.input_size(input_height * block_size, block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX16();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X16, one_row) {
size_t block_size = 3;
for (size_t input_width = 2; input_width <= 7; input_width++) {
SpaceToDepthOperatorTester()
.input_size(block_size, input_width * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX16();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X16, varying_input_size) {
size_t block_size = 3;
for (size_t input_height = 1; input_height <= 5; input_height++) {
for (size_t input_width = 1; input_width <= 5; input_width++) {
SpaceToDepthOperatorTester()
.input_size(input_height * block_size, input_width * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX16();
}
}
}
TEST(SPACE_TO_DEPTH_NHWC_X16, varying_block_size) {
for (uint32_t block_size = 2; block_size <= 5; block_size++) {
SpaceToDepthOperatorTester()
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX16();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X16, varying_input_channels) {
size_t block_size = 3;
for (size_t input_channels = 1; input_channels <= 15; input_channels++) {
SpaceToDepthOperatorTester()
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(input_channels)
.TestNHWCxX16();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X16, varying_batch_size) {
size_t block_size = 3;
for (size_t batch_size = 2; batch_size <= 3; batch_size++) {
SpaceToDepthOperatorTester()
.batch_size(batch_size)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX32();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X16, input_channels_stride) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.batch_size(1)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels_stride(10)
.input_channels(9)
.TestNHWCxX16();
}
TEST(SPACE_TO_DEPTH_NHWC_X16, output_channels_stride) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.batch_size(2)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.output_channels_stride(171)
.input_channels(17)
.TestNHWCxX32();
}
TEST(SPACE_TO_DEPTH_NHWC_X32, one_output_pixel) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.input_size(block_size, block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX32();
}
TEST(SPACE_TO_DEPTH_NHWC_X32, one_column) {
size_t block_size = 3;
for (size_t input_height = 2; input_height <= 7; input_height++) {
SpaceToDepthOperatorTester()
.input_size(input_height * block_size, block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX32();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X32, one_row) {
size_t block_size = 3;
for (size_t input_width = 2; input_width <= 7; input_width++) {
SpaceToDepthOperatorTester()
.input_size(block_size, input_width * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX32();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X32, varying_input_size) {
size_t block_size = 3;
for (size_t input_height = 1; input_height <= 5; input_height++) {
for (size_t input_width = 1; input_width <= 5; input_width++) {
SpaceToDepthOperatorTester()
.input_size(input_height * block_size, input_width * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX32();
}
}
}
TEST(SPACE_TO_DEPTH_NHWC_X32, varying_block_size) {
for (uint32_t block_size = 2; block_size <= 5; block_size++) {
SpaceToDepthOperatorTester()
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX32();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X32, varying_input_channels) {
size_t block_size = 3;
for (size_t input_channels = 1; input_channels <= 15; input_channels++) {
SpaceToDepthOperatorTester()
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(input_channels)
.TestNHWCxX32();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X32, varying_batch_size) {
size_t block_size = 3;
for (size_t batch_size = 2; batch_size <= 3; batch_size++) {
SpaceToDepthOperatorTester()
.batch_size(batch_size)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels(17)
.TestNHWCxX32();
}
}
TEST(SPACE_TO_DEPTH_NHWC_X32, input_channels_stride) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.batch_size(1)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.input_channels_stride(10)
.input_channels(9)
.TestNHWCxX32();
}
TEST(SPACE_TO_DEPTH_NHWC_X32, output_channels_stride) {
size_t block_size = 3;
SpaceToDepthOperatorTester()
.batch_size(2)
.input_size(7 * block_size, 5 * block_size)
.block_size(block_size)
.output_channels_stride(171)
.input_channels(17)
.TestNHWCxX32();
}