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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
//
// Copyright © 2023-2024 Arm Ltd and Contributors. All rights reserved.
// SPDX-License-Identifier: MIT
//
#include "ConvolutionTestHelper.hpp"
#include <doctest/doctest.h>
namespace armnnDelegate
{
void TransposeConvInt8Test()
{
// Set input data
std::vector<int32_t> transposeTensorShape { 4 };
std::vector<int32_t> filterShape { 1, 2, 2, 1 };
std::vector<int32_t> inputShape { 1, 2, 2, 1 };
std::vector<int32_t> outputShape { 1, 3, 3, 1 };
std::vector<int32_t> transposeData = { 1, 3, 3, 1 };
static std::vector<int8_t> inputValues = { 1, 2, 3, 4 };
std::vector<int8_t> filterValues = { 0, 1, 2, 4 };
std::vector<int8_t> expectedOutputValues =
{
0, 1, 2,
2, 11, 12,
6, 20, 16
};
tflite::Padding padding = tflite::Padding_VALID;
TransposeConvTest<int8_t>(::tflite::TensorType_INT8,
1, // strideX
1, // strideY
padding,
transposeTensorShape,
filterShape,
inputShape,
outputShape,
transposeData,
filterValues,
inputValues,
expectedOutputValues);
}
void TransposeConvFp32Test()
{
std::vector<int32_t> transposeTensorShape { 4 };
std::vector<int32_t> filterShape { 1, 2, 2, 1 };
std::vector<int32_t> inputShape { 1, 2, 2, 1 };
std::vector<int32_t> outputShape { 1, 3, 3, 1 };
std::vector<int32_t> transposeData = { 1, 3, 3, 1 };
static std::vector<float> inputValues = { 1, 2, 3, 4 };
std::vector<float> filterValues = { 0, 1, 2, 4 };
std::vector<float> expectedOutputValues =
{
0, 1, 2,
2, 11, 12,
6, 20, 16
};
tflite::Padding padding = tflite::Padding_VALID;
TransposeConvTest<float>(::tflite::TensorType_FLOAT32,
1, // strideX
1, // strideY
padding,
transposeTensorShape,
filterShape,
inputShape,
outputShape,
transposeData,
filterValues,
inputValues,
expectedOutputValues);
}
TEST_SUITE("TransposeConv_Test")
{
TEST_CASE ("TransposeConv_Fp32_Test")
{
TransposeConvFp32Test();
}
TEST_CASE ("TransposeConv_Int8_Test")
{
TransposeConvInt8Test();
}
} // End of TEST_SUITE(TransposeConv_Test)
} // namespace armnnDelegate
|