• 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 #ifndef MINDSPORE_LITE_SRC_RUNTIME_RUNTIME_PASS_H_
18 #define MINDSPORE_LITE_SRC_RUNTIME_RUNTIME_PASS_H_
19 
20 #ifndef RUNTIME_PASS_CLIP
21 #include <vector>
22 #include "src/lite_kernel.h"
23 #include "src/sub_graph_kernel.h"
24 #include "schema/ops_generated.h"
25 #include "schema/model_generated.h"
26 
27 namespace mindspore::lite {
28 
29 void RuntimePass(std::vector<kernel::LiteKernel *> *subgraphs, std::vector<Tensor *> *tensors);
30 
31 /* Nc4hw4 PASS
32  * before  : --(nhwc)-- CONV --(nhwc)-- TRANSPOSE --(nchw)-- IN --(nchw)-- TRANSPOSE --(nhwc)--
33  * after   : --(nhwc)-- CONV --(nc4hw4)-- IN --(nhwc)--
34  * */
35 static const schema::PrimitiveType Nc4hw4FormatTransposeOp = schema::PrimitiveType_Transpose;
36 static const std::vector<schema::PrimitiveType> Nc4hw4FormatOutOpList = {schema::PrimitiveType_Conv2DFusion};
37 static const std::vector<schema::PrimitiveType> Nc4hw4FormatInOpList = {schema::PrimitiveType_InstanceNorm};
38 
39 /*
40  * ConvNormC4 PASS
41  * before  : --(nhwc)-- CONV --(nhwc)-- INSTANCENORM --(nhwc)--
42  * after   : --(nhwc)-- CONV --(nc4hw4)-- INSTANCENORM --(nhwc)--
43  *
44  * before  : --(nhwc)-- CONV --(nhwc)-- ACT --(nhwc)-- INSTANCENORM --(nhwc)--
45  * after   : --(nhwc)-- CONV --(nc4hw4)-- ACT --(nc4hw4)-- INSTANCENORM --(nhwc)--
46  * */
47 static const schema::PrimitiveType ConvNormC4OpConv2DFusion = schema::PrimitiveType_Conv2DFusion;
48 static const schema::PrimitiveType ConvNormC4OpActivation = schema::PrimitiveType_Activation;
49 static const schema::PrimitiveType ConvNormC4OpInstanceNorm = schema::PrimitiveType_InstanceNorm;
50 
51 }  // namespace mindspore::lite
52 #endif
53 #endif  // MINDSPORE_LITE_SRC_RUNTIME_RUNTIME_PASS_H_
54