1 /**
2 * Copyright 2020 Huawei Technologies Co., Ltd
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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 */
16
17 #ifndef GE_MOCK_H
18 #define GE_MOCK_H
19 #include <iostream>
20 #include <memory>
21 #include <string>
22 #include <cstring>
23 #include <sstream>
24 #include "graph/tensor.h"
25 #include "graph/operator_reg.h"
26 #include "graph/operator.h"
27 #include "graph/utils/tensor_utils.h"
28 #include "graph/utils/tensor_adapter.h"
29
30 #include "external/ge/ge_api.h"
31
32 namespace ge {
33
Session(const std::map<std::string,std::string> & options)34 Session::Session(const std::map<std::string, std::string>& options) {}
~Session()35 Session::~Session() {}
36
RunGraph(uint32_t id,const std::vector<Tensor> & inputs,std::vector<Tensor> & outputs)37 Status Session::RunGraph(uint32_t id, const std::vector<Tensor>& inputs, std::vector<Tensor>& outputs) {
38 // for test!!! just copy inputs to outputs:
39 for (auto it = inputs.begin(); it != inputs.end(); it++) {
40 outputs.emplace_back(*it);
41 }
42 return ge::GRAPH_SUCCESS;
43 }
44
AddGraph(uint32_t id,const Graph & graph)45 Status Session::AddGraph(uint32_t id, const Graph& graph) { return ge::GRAPH_SUCCESS; }
46
GEInitialize(const std::map<std::string,std::string> & options)47 Status GEInitialize(const std::map<std::string, std::string>& options) { return ge::GRAPH_SUCCESS; }
48
GEFinalize()49 Status GEFinalize() { return ge::GRAPH_SUCCESS; }
50
SaveToFile(const string & file_name) const51 Status Graph::SaveToFile(const string& file_name) const { return ge::GRAPH_SUCCESS; }
52
53 } // namespace ge
54
55 namespace gelc {
GetOptInfo(uint32_t mode,const std::string & soc_ver,std::map<std::string,std::string> & opt_info_map)56 uint32_t GetOptInfo(uint32_t mode, const std::string &soc_ver, std::map<std::string, std::string> &opt_info_map) {
57 return 0;
58 }
59 } // namespace gelc
60 #endif
61