• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2021 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 #include "include/api/cell.h"
18 #include "src/common/log_adapter.h"
19 
20 namespace mindspore {
operator ()(const std::vector<Input> & inputs) const21 std::vector<Output> CellBase::operator()(const std::vector<Input> &inputs) const {
22   std::vector<Output> empty;
23   MS_LOG(ERROR) << "Unsupported feature.";
24   return empty;
25 }
26 
GraphCell(const Graph & graph)27 GraphCell::GraphCell(const Graph &graph) : graph_(std::shared_ptr<Graph>(new (std::nothrow) Graph(graph))) {
28   if (graph_ == nullptr) {
29     MS_LOG(ERROR) << "Invalid graph.";
30   }
31 }
32 
GraphCell(const std::shared_ptr<Graph> & graph)33 GraphCell::GraphCell(const std::shared_ptr<Graph> &graph) : graph_(graph) {
34   if (graph_ == nullptr) {
35     MS_LOG(ERROR) << "Invalid graph.";
36   }
37 }
38 
GraphCell(Graph && graph)39 GraphCell::GraphCell(Graph &&graph) : graph_(std::shared_ptr<Graph>(new (std::nothrow) Graph(graph))) {
40   if (graph_ == nullptr) {
41     MS_LOG(ERROR) << "Invalid graph.";
42   }
43 }
44 
Run(const std::vector<MSTensor> & inputs,std::vector<MSTensor> * outputs)45 Status GraphCell::Run(const std::vector<MSTensor> &inputs, std::vector<MSTensor> *outputs) {
46   MS_LOG(ERROR) << "Unsupported feature.";
47   return kLiteError;
48 }
49 
Load(uint32_t device_id)50 Status GraphCell::Load(uint32_t device_id) {
51   MS_LOG(ERROR) << "Unsupported feature.";
52   return kLiteError;
53 }
54 
InputAndOutput()55 InputAndOutput::InputAndOutput() { MS_LOG(ERROR) << "Unsupported feature."; }
56 
InputAndOutput(const std::shared_ptr<CellBase> & cell,const std::vector<InputAndOutput> & prev,int32_t index)57 InputAndOutput::InputAndOutput(const std::shared_ptr<CellBase> &cell, const std::vector<InputAndOutput> &prev,
58                                int32_t index) {
59   MS_LOG(ERROR) << "Unsupported feature.";
60 }
61 }  // namespace mindspore
62