xref: /aosp_15_r20/external/armnn/src/armnnOnnxParser/test/Relu.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "armnnOnnxParser/IOnnxParser.hpp"
7 #include  "ParserPrototxtFixture.hpp"
8 
9 TEST_SUITE("OnnxParser_Relu")
10 {
11 struct ReluMainFixture : public armnnUtils::ParserPrototxtFixture<armnnOnnxParser::IOnnxParser>
12 {
ReluMainFixtureReluMainFixture13     ReluMainFixture()
14     {
15         m_Prototext = R"(
16                    ir_version: 3
17                    producer_name:  "CNTK"
18                    producer_version:  "2.5.1"
19                    domain:  "ai.cntk"
20                    model_version: 1
21                    graph {
22                      name:  "CNTKGraph"
23                      input {
24                         name: "Input"
25                         type {
26                           tensor_type {
27                             elem_type: 1
28                             shape {
29                               dim {
30                                 dim_value: 4
31                               }
32                             }
33                           }
34                         }
35                       }
36                      node {
37                          input: "Input"
38                          output: "Output"
39                          name: "ActivationLayer"
40                          op_type: "Relu"
41                     }
42                       output {
43                           name: "Output"
44                           type {
45                              tensor_type {
46                                elem_type: 1
47                                shape {
48                                    dim {
49                                        dim_value: 4
50                                    }
51                                }
52                             }
53                          }
54                       }
55                     }
56                    opset_import {
57                       version: 7
58                     })";
59         Setup();
60     }
61 };
62 
63 TEST_CASE_FIXTURE(ReluMainFixture, "ValidReluTest")
64 {
65     RunTest<1>({{"Input",  { -1.0f, -0.5f, 1.25f, -3.0f}}},
66                {{ "Output", { 0.0f, 0.0f, 1.25f, 0.0f}}});
67 }
68 
69 }
70