XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 1 | // 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 Dukhan | efc47b8 | 2019-11-18 09:25:38 -0800 | [diff] [blame] | 11 | TEST(HARDSWISH_NC_F32, unit_batch) { |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 12 | 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 Dukhan | efc47b8 | 2019-11-18 09:25:38 -0800 | [diff] [blame] | 21 | TEST(HARDSWISH_NC_F32, small_batch) { |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 22 | 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 Dukhan | efc47b8 | 2019-11-18 09:25:38 -0800 | [diff] [blame] | 31 | TEST(HARDSWISH_NC_F32, small_batch_with_input_stride) { |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 32 | 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 Dukhan | efc47b8 | 2019-11-18 09:25:38 -0800 | [diff] [blame] | 42 | TEST(HARDSWISH_NC_F32, small_batch_with_output_stride) { |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 43 | 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 Dukhan | efc47b8 | 2019-11-18 09:25:38 -0800 | [diff] [blame] | 53 | TEST(HARDSWISH_NC_F32, small_batch_with_input_and_output_stride) { |
XNNPACK Team | b455b12 | 2019-09-27 18:10:33 -0700 | [diff] [blame] | 54 | 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 | } |