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