blob: ef803964fd638a476d9d263c4c458361c25b3cd1 [file] [log] [blame]
Tianle Cheng92ce35c2023-07-25 16:41:00 +01001//
2// Copyright © 2023 Arm Ltd and Contributors. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include "TileTestHelper.hpp"
7
8#include <armnn_delegate.hpp>
9#include <flatbuffers/flatbuffers.h>
10#include <tensorflow/lite/interpreter.h>
11#include <tensorflow/lite/kernels/register.h>
12#include <tensorflow/lite/model.h>
Tianle Cheng92ce35c2023-07-25 16:41:00 +010013#include <tensorflow/lite/version.h>
14#include <doctest/doctest.h>
15
16namespace armnnDelegate
17{
18void TileFloat32Test(std::vector<armnn::BackendId>& backends)
19{
20 // Set input data
21 std::vector<float> inputValues =
22 {
23 0.f, 1.f, 2.f,
24 3.f, 4.f, 5.f
25 };
26
27 // Set output data
28 std::vector<float> expectedOutputValues =
29 {
30 0.f, 1.f, 2.f, 0.f, 1.f, 2.f,
31 3.f, 4.f, 5.f, 3.f, 4.f, 5.f,
32
33 0.f, 1.f, 2.f, 0.f, 1.f, 2.f,
34 3.f, 4.f, 5.f, 3.f, 4.f, 5.f
35 };
36
37 // The multiples
38 const std::vector<int32_t> multiplesValues = { 2, 2 };
39
40 // Set shapes
41 const std::vector<int32_t> inputShape = { 2, 3 };
42 const std::vector<int32_t> multiplesShape = { 2 };
43 const std::vector<int32_t> expectedOutputShape = { 4, 6 };
44
45 TileFP32TestImpl(tflite::BuiltinOperator_TILE,
46 backends,
47 inputValues,
48 inputShape,
49 multiplesValues,
50 multiplesShape,
51 expectedOutputValues,
52 expectedOutputShape);
53}
54
Tianle Cheng92ce35c2023-07-25 16:41:00 +010055TEST_SUITE("TileTests_GpuAccTests")
56{
57
58 TEST_CASE ("Tile_Float32_GpuAcc_Test")
59 {
60 std::vector<armnn::BackendId> backends = { armnn::Compute::GpuAcc };
61 TileFloat32Test(backends);
62 }
63
64} // TEST_SUITE("Tile_Float32_GpuAcc_Test")
Tianle Cheng92ce35c2023-07-25 16:41:00 +010065
66TEST_SUITE("TileTests_CpuAccTests")
67{
68
69 TEST_CASE ("Tile_Float32_CpuAcc_Test")
70 {
71 std::vector<armnn::BackendId> backends = { armnn::Compute::CpuAcc };
72 TileFloat32Test(backends);
73 }
74
75} // TEST_SUITE("Tile_Float32_CpuAcc_Test")
76
77TEST_SUITE("TileTests_CpuRefTests")
78{
79
80 TEST_CASE ("Tile_Float32_CpuRef_Test")
81 {
82 std::vector<armnn::BackendId> backends = { armnn::Compute::CpuRef };
83 TileFloat32Test(backends);
84 }
85
86} // TEST_SUITE("Tile_Float32_CpuRef_Test")
87
88} // namespace armnnDelegate