1 //*****************************************************************************
2 // Copyright 2017-2020 Intel Corporation
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //*****************************************************************************
17 #include "gtest/gtest.h"
19 #include "ngraph/ngraph.hpp"
23 NGRAPH_SUPPRESS_DEPRECATED_START
26 using namespace ngraph;
28 TEST(input_output, param_tensor)
30 // Params have no arguments, so we can check that the value becomes a tensor output
31 auto& et = element::f32;
33 auto param = make_shared<op::Parameter>(et, shape);
35 ASSERT_EQ(param->get_output_size(), 1);
36 ASSERT_EQ(et, param->get_element_type());
37 ASSERT_EQ(shape, param->get_shape());
40 TEST(input_output, simple_output)
42 auto param_0 = make_shared<op::Parameter>(element::f32, Shape{2, 4});
43 auto param_1 = make_shared<op::Parameter>(element::f32, Shape{2, 4});
44 auto add = make_shared<op::Add>(param_0, param_1);
47 vector<shared_ptr<Node>> nodes;
48 nodes.push_back(param_0);
49 nodes.push_back(param_1);
52 // At this point, the add should have each input associated with the output of the appropriate
54 ASSERT_EQ(1, add->get_output_size());
55 ASSERT_EQ(2, add->get_input_size());
56 for (size_t i = 0; i < add->get_input_size(); i++)
58 ASSERT_EQ(add->input_value(i).get_node_shared_ptr(), nodes.at(i));