• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
TEST(HARDSWISH_NC_F16,unit_batch)10 TEST(HARDSWISH_NC_F16, unit_batch) {
11   for (size_t channels = 1; channels < 100; channels++) {
12     HardSwishOperatorTester()
13       .batch_size(1)
14       .channels(channels)
15       .iterations(3)
16       .TestF16();
17   }
18 }
19 
TEST(HARDSWISH_NC_F16,small_batch)20 TEST(HARDSWISH_NC_F16, small_batch) {
21   for (size_t channels = 1; channels < 100; channels++) {
22     HardSwishOperatorTester()
23       .batch_size(3)
24       .channels(channels)
25       .iterations(3)
26       .TestF16();
27   }
28 }
29 
TEST(HARDSWISH_NC_F16,small_batch_with_input_stride)30 TEST(HARDSWISH_NC_F16, small_batch_with_input_stride) {
31   for (size_t channels = 1; channels < 100; channels += 15) {
32     HardSwishOperatorTester()
33       .batch_size(3)
34       .channels(channels)
35       .input_stride(129)
36       .iterations(3)
37       .TestF16();
38   }
39 }
40 
TEST(HARDSWISH_NC_F16,small_batch_with_output_stride)41 TEST(HARDSWISH_NC_F16, small_batch_with_output_stride) {
42   for (size_t channels = 1; channels < 100; channels += 15) {
43     HardSwishOperatorTester()
44       .batch_size(3)
45       .channels(channels)
46       .output_stride(117)
47       .iterations(3)
48       .TestF16();
49   }
50 }
51 
TEST(HARDSWISH_NC_F16,small_batch_with_input_and_output_stride)52 TEST(HARDSWISH_NC_F16, small_batch_with_input_and_output_stride) {
53   for (size_t channels = 1; channels < 100; channels += 15) {
54     HardSwishOperatorTester()
55       .batch_size(3)
56       .channels(channels)
57       .input_stride(129)
58       .output_stride(117)
59       .iterations(3)
60       .TestF16();
61   }
62 }
63 
TEST(HARDSWISH_NC_F32,unit_batch)64 TEST(HARDSWISH_NC_F32, unit_batch) {
65   for (size_t channels = 1; channels < 100; channels++) {
66     HardSwishOperatorTester()
67       .batch_size(1)
68       .channels(channels)
69       .iterations(3)
70       .TestF32();
71   }
72 }
73 
TEST(HARDSWISH_NC_F32,small_batch)74 TEST(HARDSWISH_NC_F32, small_batch) {
75   for (size_t channels = 1; channels < 100; channels++) {
76     HardSwishOperatorTester()
77       .batch_size(3)
78       .channels(channels)
79       .iterations(3)
80       .TestF32();
81   }
82 }
83 
TEST(HARDSWISH_NC_F32,small_batch_with_input_stride)84 TEST(HARDSWISH_NC_F32, small_batch_with_input_stride) {
85   for (size_t channels = 1; channels < 100; channels += 15) {
86     HardSwishOperatorTester()
87       .batch_size(3)
88       .channels(channels)
89       .input_stride(129)
90       .iterations(3)
91       .TestF32();
92   }
93 }
94 
TEST(HARDSWISH_NC_F32,small_batch_with_output_stride)95 TEST(HARDSWISH_NC_F32, small_batch_with_output_stride) {
96   for (size_t channels = 1; channels < 100; channels += 15) {
97     HardSwishOperatorTester()
98       .batch_size(3)
99       .channels(channels)
100       .output_stride(117)
101       .iterations(3)
102       .TestF32();
103   }
104 }
105 
TEST(HARDSWISH_NC_F32,small_batch_with_input_and_output_stride)106 TEST(HARDSWISH_NC_F32, small_batch_with_input_and_output_stride) {
107   for (size_t channels = 1; channels < 100; channels += 15) {
108     HardSwishOperatorTester()
109       .batch_size(3)
110       .channels(channels)
111       .input_stride(129)
112       .output_stride(117)
113       .iterations(3)
114       .TestF32();
115   }
116 }
117