blob: 858d5c19907c12b871e17456ca474d8c35aa3f4f [file] [log] [blame]
XNNPACK Teamb455b122019-09-27 18:10:33 -07001// Copyright 2019 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 "hardswish-operator-tester.h"
9
10
Marat Dukhanefc47b82019-11-18 09:25:38 -080011TEST(HARDSWISH_NC_F32, unit_batch) {
XNNPACK Teamb455b122019-09-27 18:10:33 -070012 for (size_t channels = 1; channels < 100; channels++) {
13 HardSwishOperatorTester()
14 .batch_size(1)
15 .channels(channels)
16 .iterations(3)
17 .TestF32();
18 }
19}
20
Marat Dukhanefc47b82019-11-18 09:25:38 -080021TEST(HARDSWISH_NC_F32, small_batch) {
XNNPACK Teamb455b122019-09-27 18:10:33 -070022 for (size_t channels = 1; channels < 100; channels++) {
23 HardSwishOperatorTester()
24 .batch_size(3)
25 .channels(channels)
26 .iterations(3)
27 .TestF32();
28 }
29}
30
Marat Dukhanefc47b82019-11-18 09:25:38 -080031TEST(HARDSWISH_NC_F32, small_batch_with_input_stride) {
XNNPACK Teamb455b122019-09-27 18:10:33 -070032 for (size_t channels = 1; channels < 100; channels += 15) {
33 HardSwishOperatorTester()
34 .batch_size(3)
35 .channels(channels)
36 .input_stride(129)
37 .iterations(3)
38 .TestF32();
39 }
40}
41
Marat Dukhanefc47b82019-11-18 09:25:38 -080042TEST(HARDSWISH_NC_F32, small_batch_with_output_stride) {
XNNPACK Teamb455b122019-09-27 18:10:33 -070043 for (size_t channels = 1; channels < 100; channels += 15) {
44 HardSwishOperatorTester()
45 .batch_size(3)
46 .channels(channels)
47 .output_stride(117)
48 .iterations(3)
49 .TestF32();
50 }
51}
52
Marat Dukhanefc47b82019-11-18 09:25:38 -080053TEST(HARDSWISH_NC_F32, small_batch_with_input_and_output_stride) {
XNNPACK Teamb455b122019-09-27 18:10:33 -070054 for (size_t channels = 1; channels < 100; channels += 15) {
55 HardSwishOperatorTester()
56 .batch_size(3)
57 .channels(channels)
58 .input_stride(129)
59 .output_stride(117)
60 .iterations(3)
61 .TestF32();
62 }
63}