aboutsummaryrefslogtreecommitdiff
path: root/src/armnnTfParser/test/TestMultiInputsOutputs.cpp
blob: a6d18b374ccb4802a0cf04899136fd007dd42f75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//
// Copyright © 2017 Arm Ltd. All rights reserved.
// SPDX-License-Identifier: MIT
//

#include <boost/test/unit_test.hpp>
#include "armnnTfParser/ITfParser.hpp"
#include "ParserPrototxtFixture.hpp"

BOOST_AUTO_TEST_SUITE(TensorflowParser)

struct MultiInputsOutputsFixture : public armnnUtils::ParserPrototxtFixture<armnnTfParser::ITfParser>
{
    MultiInputsOutputsFixture()
    {
        // Input1 = tf.placeholder(tf.float32, shape=[], name = "input1")
        // Input2 = tf.placeholder(tf.float32, shape = [], name = "input2")
        // Add1 = tf.add(input1, input2, name = "add1")
        // Add2 = tf.add(input1, input2, name = "add2")
        m_Prototext = R"(
node {
  name: "input1"
  op: "Placeholder"
  attr {
    key: "dtype"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "shape"
    value {
      shape {
      }
    }
  }
}
node {
  name: "input2"
  op: "Placeholder"
  attr {
    key: "dtype"
    value {
      type: DT_FLOAT
    }
  }
  attr {
    key: "shape"
    value {
      shape {
      }
    }
  }
}
node {
  name: "add1"
  op: "Add"
  input: "input1"
  input: "input2"
  attr {
    key: "T"
    value {
      type: DT_FLOAT
    }
  }
}
node {
  name: "add2"
  op: "Add"
  input: "input1"
  input: "input2"
  attr {
    key: "T"
    value {
      type: DT_FLOAT
    }
  }
}
        )";
        Setup({ { "input1", { 1 } },
                { "input2", { 1 } } },
              { "add1", "add2" });
    }
};

BOOST_FIXTURE_TEST_CASE(MultiInputsOutputs, MultiInputsOutputsFixture)
{
    RunTest<1>({ { "input1", {12.0f} }, { "input2", { 13.0f } } },
               { { "add1", { 25.0f } }, { "add2", { 25.0f } } });
}

BOOST_AUTO_TEST_SUITE_END()