blob: 6924c060a69f4767de81169a6ed8944002a95c68 [file] [log] [blame]
Mohamed Nour Abouelseoud7a8892f2019-01-09 14:19:58 +00001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#include <boost/test/unit_test.hpp>
7#include "armnnTfParser/ITfParser.hpp"
8#include "ParserPrototxtFixture.hpp"
9
10BOOST_AUTO_TEST_SUITE(TensorflowParser)
11
12struct RsqrtFixture : public armnnUtils::ParserPrototxtFixture<armnnTfParser::ITfParser>
13{
14 RsqrtFixture()
15 {
16 m_Prototext = "node {\n"
17 " name: \"input\"\n"
18 " op: \"Placeholder\"\n"
19 " attr {\n"
20 " key: \"dtype\"\n"
21 " value {\n"
22 " type: DT_FLOAT\n"
23 " }\n"
24 " }\n"
25 " attr {\n"
26 " key: \"shape\"\n"
27 " value {\n"
28 " shape {\n"
29 " }\n"
30 " }\n"
31 " }\n"
32 "}\n"
33 "node {\n"
34 " name: \"Rsqrt\"\n"
35 " op: \"Rsqrt\"\n"
36 " input: \"input\"\n"
37 " attr {\n"
38 " key: \"T\"\n"
39 " value {\n"
40 " type: DT_FLOAT\n"
41 " }\n"
42 " }\n"
43 "}\n";
44
45 SetupSingleInputSingleOutput({ 2, 2 }, "input", "Rsqrt");
46 }
47};
48
49BOOST_FIXTURE_TEST_CASE(ParseRsqrt, RsqrtFixture)
50{
51 RunTest<2>({ 1.f, 4.f, 16.f, 25.f }, { 1.f, 0.5f, 0.25f, 0.2f });
52}
53
54BOOST_FIXTURE_TEST_CASE(ParseRsqrtZeroNegative, RsqrtFixture)
55{
56 RunTest<2>({ 0.f, -0.f, -25.f, -16.f }, { INFINITY, -INFINITY, -NAN, -NAN });
57}
58
59BOOST_AUTO_TEST_SUITE_END()