2 * Copyright (c) 2019 Samsung Electronics Co., Ltd. All Rights Reserved
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.
17 #include "moco/Import/Nodes/Concat.h"
18 #include "TestHelper.h"
20 #include <gtest/gtest.h>
22 using namespace moco::test;
28 const char *concat_01_pbtxtdata = STRING_CONTENT(
57 TEST(TensorFlowImport, concat_01)
59 TFNodeBuildTester tester;
60 moco::ConcatV2GraphBuilder graphbuilder;
61 tensorflow::NodeDef nodedef;
63 EXPECT_TRUE(plier::tf::parse_nodedef(concat_01_pbtxtdata, nodedef));
66 // - there should exist TFConcatV2
67 // - there should be two values
68 // - values(idx) should not be nullptr
69 // - axis() should not be nullptr
71 tester.inputs({"Input01", "Input02", "Axis"});
72 tester.output("Concat");
73 tester.run(nodedef, graphbuilder);
75 auto test_node = loco::must_cast<moco::TFConcatV2 *>(tester.output());
76 ASSERT_NE(test_node, nullptr);
77 ASSERT_EQ(test_node->num_values(), 2);
84 const char *concat_02_pbtxtdata = STRING_CONTENT(
114 TEST(TensorFlowImport, concat_02)
116 TFNodeBuildTester tester;
117 moco::ConcatV2GraphBuilder graphbuilder;
118 tensorflow::NodeDef nodedef;
120 EXPECT_TRUE(plier::tf::parse_nodedef(concat_02_pbtxtdata, nodedef));
122 // what to test: TFConcatV2 has 3 inputs
123 // - there should exist TFConcatV2
124 // - values(idx) should not be nullptr
125 // - axis() should not be nullptr
127 tester.inputs({"Input01", "Input02", "Input03", "Axis"});
128 tester.output("Concat");
129 tester.run(nodedef, graphbuilder);
131 auto test_node = loco::must_cast<moco::TFConcatV2 *>(tester.output());
132 ASSERT_NE(test_node, nullptr);
133 ASSERT_EQ(test_node->num_values(), 3);