|
- /**
- * Copyright 2021 Huawei Technologies Co., Ltd
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
- #include <gtest/gtest.h>
- #include <map>
- #include "external/ge/ge_api.h"
- #include "framework/common/types.h"
- #include "framework.h"
- #include "framework/utils/builder/graph_builder_utils.h"
-
- using namespace std;
- using namespace ge;
- class FrameworkTest : public testing::Test {
- protected:
- void SetUp() {
- // ge initialize
- map<AscendString, AscendString> options;
- auto ret = ge::GEInitialize(options);
- EXPECT_EQ(ret, SUCCESS);
- }
- void TearDown() {}
- };
-
- TEST_F(FrameworkTest, test_framework_dummy) {
- // build graph
- st::ComputeGraphBuilder graphBuilder("g1");
- auto data1 = graphBuilder.AddNode("data1",DATA,1,1);
- auto data2 = graphBuilder.AddNode("data2",DATA,1,1);
- auto add = graphBuilder.AddNode("add",ADD,2,1);
- graphBuilder.AddDataEdge(data1, 0, add,0);
- graphBuilder.AddDataEdge(data2, 0, add,1);
- Graph graph = graphBuilder.GetGraph();
-
- // new session & add graph
- map<AscendString, AscendString> options;
- Session session(options);
- auto ret = session.AddGraph(1, graph, options);
- EXPECT_EQ(ret, SUCCESS);
- // build input tensor
- std::vector<InputTensorInfo> inputs;
- // build_graph through session
- ret = session.BuildGraph(1, inputs);
-
- // TODO check result
- }
|