forked from google/XNNPACK
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqs8-vlrelu.cc
59 lines (55 loc) · 4.65 KB
/
qs8-vlrelu.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright 2019 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.
//
// Auto-generated file. Do not edit!
// Microkernel: qs8-vlrelu
// Generator: tools/generate-vunary-test.py
#include <array>
#include <cmath>
#include <cstdint>
#include <cstddef>
#include <limits>
#include <gtest/gtest.h>
#include "xnnpack.h"
#include "xnnpack/common.h"
#include "xnnpack/isa-checks.h"
#include "xnnpack/microparams-init.h"
#include "xnnpack/microparams.h"
#include "xnnpack/vlrelu.h"
#include "next_prime.h"
#include "vlrelu-microkernel-tester.h"
#define XNN_UKERNEL_WITH_PARAMS(arch_flags, ukernel, batch_tile, vector_tile, datatype, params_type, init_params) \
\
XNN_TEST_UNARY_BATCH_EQ(ukernel, arch_flags, batch_tile, datatype, ukernel, init_params); \
XNN_TEST_UNARY_BATCH_DIV(ukernel, arch_flags, batch_tile, datatype, ukernel, init_params); \
XNN_TEST_UNARY_BATCH_LT(ukernel, arch_flags, batch_tile, datatype, ukernel, init_params); \
XNN_TEST_UNARY_BATCH_GT(ukernel, arch_flags, batch_tile, datatype, ukernel, init_params); \
\
XNN_TEST_UNARY_INPLACE(ukernel, arch_flags, batch_tile, datatype, ukernel, init_params); \
TEST(ukernel, positive_scale) { \
TEST_REQUIRES_ARCH_FLAGS(arch_flags); \
for (size_t batch_size = 1; batch_size <= batch_tile * 5; batch_size += std::max(1, batch_tile - 1)) { \
for (float positive_scale : std::vector<float>({1.0f / 256.0f, 0.3f, 1.3f, 128.0f})) { \
VLReLUMicrokernelTester() \
.batch_size(batch_size) \
.positive_scale(positive_scale) \
.Test(ukernel, init_params); \
} \
} \
} \
\
TEST(ukernel, negative_scale) { \
TEST_REQUIRES_ARCH_FLAGS(arch_flags); \
for (size_t batch_size = 1; batch_size <= batch_tile * 5; batch_size += std::max(1, batch_tile - 1)) { \
for (float negative_scale : std::vector<float>({-127.99609375f, -1.3f, -0.3f, -1.0f / 256.0f, 1 / 256.0f, 0.3f, 1.3f, 128.0f})) {\
VLReLUMicrokernelTester() \
.batch_size(batch_size) \
.negative_scale(negative_scale) \
.Test(ukernel, init_params); \
} \
} \
}
#include "src/qs8-vlrelu/qs8-vlrelu.h"
#undef XNN_UKERNEL_WITH_PARAMS