blob: 4aac1a77b370b61bb62674181d265ed8983a31cb [file] [log] [blame]
Sadik Armagan788e2c62021-02-10 16:26:44 +00001//
Teresa Charlinad1b3d72023-03-14 12:10:28 +00002// Copyright © 2021, 2023 Arm Ltd and Contributors. All rights reserved.
Sadik Armagan788e2c62021-02-10 16:26:44 +00003// SPDX-License-Identifier: MIT
4//
5
6#include "RoundTestHelper.hpp"
7
8#include <armnn_delegate.hpp>
9
10#include <flatbuffers/flatbuffers.h>
Sadik Armagan788e2c62021-02-10 16:26:44 +000011
12#include <doctest/doctest.h>
13
14namespace armnnDelegate
15{
16
17void FloorFp32Test(std::vector<armnn::BackendId>& backends)
18{
19 std::vector<int32_t> inputShape {1, 3, 2, 3};
20 std::vector<int32_t> outputShape {1, 3, 2, 3};
21
22 std::vector<float> inputValues { -37.5f, -15.2f, -8.76f, -2.0f, -1.5f, -1.3f, -0.5f, -0.4f, 0.0f,
23 1.0f, 0.4f, 0.5f, 1.3f, 1.5f, 2.0f, 8.76f, 15.2f, 37.5f };
24
25 std::vector<float> expectedOutputValues { -38.0f, -16.0f, -9.0f, -2.0f, -2.0f, -2.0f, -1.0f, -1.0f, 0.0f,
26 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 2.0f, 8.0f, 15.0f, 37.0f };
27
28 RoundTest<float>(tflite::BuiltinOperator_FLOOR,
29 ::tflite::TensorType_FLOAT32,
30 backends,
31 inputShape,
32 inputValues,
33 expectedOutputValues);
34}
35
36// FLOOR Test Suite
37TEST_SUITE("FLOOR_CpuRefTests")
38{
39
40TEST_CASE ("FLOOR_Fp32_CpuRef_Test")
41{
42 std::vector<armnn::BackendId> backends = {armnn::Compute::CpuRef};
43 FloorFp32Test(backends);
44}
45
46}
47
48TEST_SUITE("FLOOR_CpuAccTests")
49{
50
51TEST_CASE ("FLOOR_Fp32_CpuAcc_Test")
52{
53 std::vector<armnn::BackendId> backends = {armnn::Compute::CpuAcc};
54 FloorFp32Test(backends);
55}
56
57}
58
59TEST_SUITE("FLOOR_GpuAccTests")
60{
61
62TEST_CASE ("FLOOR_Fp32_GpuAcc_Test")
63{
64 std::vector<armnn::BackendId> backends = {armnn::Compute::GpuAcc};
65 FloorFp32Test(backends);
66}
67
68}
69// End of FLOOR Test Suite
70
71} // namespace armnnDelegate