• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2022 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 "src/control_flow/control_subgraph_creator.h"
18 #ifndef CONTROLFLOW_TENSORLIST_CLIP
19 #include "src/control_flow/kernel/entrance_subgraph_kernel.h"
20 #include "src/control_flow/kernel/exit_subgraph_kernel.h"
21 #endif
22 
23 namespace mindspore::lite {
24 #ifndef CONTROLFLOW_TENSORLIST_CLIP
CreateControlSubgraph(const kernel::SubGraphType & type,kernel::MSKernel * kernel)25 kernel::SubGraphKernel *CreateControlSubgraph(const kernel::SubGraphType &type, kernel::MSKernel *kernel) {
26   kernel::SubGraphKernel *sub_graph = nullptr;
27   switch (type) {
28     case kernel::kEntranceSubGraph: {
29       sub_graph = kernel::EntranceSubGraphKernel::Create(kernel);
30     } break;
31     case kernel::kExitSubGraph: {
32       sub_graph = kernel::ExitSubGraphKernel::Create(kernel);
33     } break;
34     default: {
35       MS_LOG(ERROR) << "not support subgraph type: " << type;
36     }
37   }
38   return sub_graph;
39 }
40 #else
41 kernel::SubGraphKernel *CreateControlSubgraph(const kernel::SubGraphType &type, kernel::MSKernel *kernel) {
42   return nullptr;
43 }
44 #endif
45 }  // namespace mindspore::lite
46